Class A and Class B Operations
Cloud Storage bills for API calls as well as for bytes. Class A covers writes and listing; Class B covers reads. Listing is the one that catches people: it is a Class A operation, and code that lists a bucket in a loop can generate an operations bill larger than the storage bill.
Billed: Per 10,000 operations. Class A (writes, lists) costs roughly ten times Class B (reads).
What triggers this charge
- Bucket listing calls, especially recursive listings of buckets with millions of objects — each page of results is a separate billed operation.
- Object writes, including every part of a resumable upload.
- Reads, at a lower rate but at high volume for a public asset bucket.
- Monitoring or sync tools polling bucket contents on a short interval.
How to reduce it
Stop listing to check existence
A direct metadata GET on a known object name is a Class B operation; listing the prefix to find it is Class A and returns far more data.
Use Pub/Sub notifications instead of polling
Object change notifications replace a polling loop entirely, which removes the operations charge rather than reducing it.
Flatten deep prefix hierarchies
Deeply nested "directories" turn one logical listing into many API calls. Cloud Storage has no real directories, so the hierarchy costs without helping.
Rates
Now find out how much of this you are actually paying.
Finitizer breaks your Google Cloud bill down to the SKU, shows how each one has moved since last week, and separates rate changes from usage changes — so you know whether to talk to engineering or to procurement.