R2 ListObjects pricing: what listing on every request costs
R2 egress is free, so people stop thinking about R2 cost. ListObjects is a Class A operation at $4.50 per million.
R2's free egress is great, and I think it makes people (me) stop thinking about R2 cost at all. But operations aren't free.
For Standard storage, Class A operations (writes and listing) are $4.50 per million. Class B, mostly reads, are $0.36 per million. So a list() on every request to find "the latest file" costs 12.5x what a get() on a known key would.
At 50 requests per second that's 4.32M list calls a day, about $19 a day. Not a disaster, but it's ~$580 a month for something a fixed key like latest.json would solve.
Also, unlike most products, R2 bills past its free tier on every plan, Free included. So this one can cost you even if you never upgraded.
Fixes
- Write a pointer object with a known key and read that instead of listing.
- Cache the list result in the Worker for a bit if it doesn't change often.
- Check R2 operations by class in the dashboard. If Class A is way above your write volume, something is listing.