Confusing R2 Usage & Pricing

Long story short, we have a bucket and a simple document inside it. We then test with sample code to retrieve the object:

        const object = await env.MY_BUCKET.get(key);

        if (object === null) {
          return new Response('Object Not Found', { status: 404 });
        }

        const headers = new Headers();
        object.writeHttpMetadata(headers);
        headers.set('etag', object.httpEtag);

        return new Response(object.body, {
          headers,
        });

According to the documentation, this should could a Class B operation. However, after testing several times, at specific intervals to ensure the reporting is correct, Class A operations are recorded as well.

This is pretty confusing, because you are reading the document - not “changing it’s state” and you shouldn’t be charged for this. So if one reads this file 1 million times, then instead of having just Class B operations billed, Class A operations are billed as well. On top of this, instead of one single operation per object request, you get 2…

image

To top this up… did I mention that you also get billed every time you refresh the dashboard?..

image

This is very confusing and not feasible to use on large scale. You end up spending nearly the same as you would use AWS or some other cloud giant.

Can someone from Cloudflare please clarify?

Thanks

Likely the Class A operations are when you are refreshing the dashboard to see if the item.

This is very much not true. You get 1 million free Class A operations and 10 million free Class B.
S3 gives you 20,000 GET operations and 2,000 PUT, COPY, POST, LIST requests per month.

Incorrect… I did not refresh the dashboard every minute, I refreshed it every 5 mins and did a worker request at specific timestamp.

How many millions of times a month are you planning to refresh the dashboard such that the operations become less economically advantageous than AWS?

This is not the point, the point is you read the file one time and it charges you 3 times. We are deviating from the main issue.

One time read = one Class B operation. That should be the case.

1 Like