🚀 Vantage Launches Autopilot: A Managed Savings Engine for AWS

Storage Wars: R2 vs S3 with New Pricing from Cloudflare

Last year, Cloudflare announced R2, an S3-compatible object storage service with no data egress fees. No data transfer fees is a direct challenge to Amazon’s well-known cloud pricing model; services get cheaper over time and at scale, but moving data out of AWS is expensive.

At the time of the announcement of R2, little was known about its pricing beyond a $0.015 per GB storage cost and $0 data transfer fees. We recognized the R2 Private Beta as a large opportunity for savings and were eager to see final pricing details. Alongside Workers and 54% growth in Q4 2022, Cloudflare was positioning itself as a serious cloud computing alternative.

R2 vs S3

Let's see what savings are possible by using R2 instead of S3

Now, Cloudflare has announced the Open Beta and full pricing for R2. Cloudflare has also specified R2’s S3 API coverage for the first time. The means we can compare pricing and functionality to discuss about what workloads would be candidates to migrate from S3 to R2 for savings. In Scenario 1, R2 is 99% cheaper than S3, while in Scenario 2, S3 is 75% cheaper than R2 (read scenarios).

Cloudflare R2 Pricing Breakdown

Cloudflare R2 Pricing has two dimensions, storage and operations. Storage is cumulative of GB, per month. Operations are divided into Class A operations which “tend to mutate state” and Class B operations which are cheaper and lighter weight.

R2 Data Storage Cost
All storage / Month $0.015 per GB

Cost to store data for Cloudflare R2

R2 Operation Type Cost
Class A (PUT, POST, LIST) $0.0045 per 1,000
Class B (GET, SELECT) $0.00036 per 1,000

Cost to make API requests for Cloudflare R2

You can see this is missing a dimension that S3 has - data egress costs. There are $0 per GB data transfer fees with R2, a significant savings for some workloads like a static image hosting service which is profiled below.

S3 Pricing

AWS says there are 6 cost components to S3, the Cloud Costs Handbook lists 19 storage classes, and between storage and transfer there are 7 GB tiers. With S3, you can configure the service match your storage needs exactly - but there are always egress fees.

An extremely important caveat for the rates shown below is the 19 storage classes. They are all priced differently and AWS has even added S3 Intelligent Tiering, a cost automation service which moves data to cheaper tiers as it becomes stale. As always, the pricing is different per region and these prices are for us-east-1, the cheapest region.

S3 Data Storage Cost
First 50 TB / Month $0.023 per GB
Next 450 TB / Month $0.022 per GB
Over 500 TB / Month $0.021 per GB

Standard data storage rates for S3.

What Cloudflare calls operations, S3 calls requests. AWS categorizes them according to the same logic as Classes but just indicates that PUT and POST requests are more expensive than GET requests. Note: You may be wondering in the table below what kind of HTTP operation is SELECT. This is actually a SQL query that can be run against S3 buckets at a cost of $0.0004 per query, an example of an advanced S3 feature that has not been implemented in R2.

S3 Request Cost
PUT, POST, LIST, COPY $0.005 per 1,000
GET, SELECT, etc $0.0004 per 1,000

Cost to make API requests to S3

So far in this pricing breakdown, S3 and R2 are directly comparable. But S3 has a third dimension that R2 does not. When sending data outside of AWS you will pay the following fees:

S3 Data Transfer Tier Cost
First 10 TB / Month $0.09 per GB
Next 40 TB / Month $0.085 per GB
Next 100 TB / Month $0.07 per GB
Greater than 150 TB / Month $0.05 per GB

Data transfer rates for S3

Comparing Free Tiers

Both R2 and S3 offer some free usage. The biggest notable difference is the massive amount of free requests that Cloudflare offers. The motivation for this is not entirely clear but 1M POST requests per month could service a medium sized web application.

R2 Feature Free Usage Amount
Data Storage 10 GB per month
Class A Operations (POST) 1M per month
Class B Operations (GET) 10M per month

Cloudflare R2 free tier

What can you do with the storage levels for these free tiers? A 5 minute screen recording is about 100 MB. 50 screen recordings are 5 GB, the free AWS storage limit. If each screen recording is downloaded 20 times in a month, that’s the free limit on data transfer for S3.

S3 Feature Free Usage Amount
Data Storage 5 GB per month
PUT, POST, LIST 2K per month
GET 20K per month
Data Transfer 100 GB

AWS S3 free tier

Example Scenarios

With pricing models in tow, let’s compare workloads. Here it’s important to talk about features, where S3 has a huge headstart. Cloudflare has committed to an extensive roadmap for R2, but the emergence of serverless and other new paradigms means they will probably never match S3 exactly.

Scenario 1: Image Hosting Site like Imgur or Flickr

For this hypothetical image hosting site, users upload 1M images a month and they download (display in their browser) 100M images. The average image size is 1 MB. That means this site is adding 1 TB of new storage a month. On S3 that costs $23. On R2 it costs $15 to store 1M images.

To POST those images, it costs $5 on S3 and $4.50 on R2. To GET those images 100M times a month, it costs $40 on S3 and $36 on R2. So far, R2 is a little cheaper with a monthly charge of $55.50 versus $68.00.

But we have not factored in data transfer charges. For 100M downloads needing a total bandwidth of 100 TB, the pricing on the standard S3 storage class will be…

  • 10 TB X $0.09 per GB = $900 +
  • 40 TB X $0.085 = $3,400 +
  • 50 TB X $0.07 = $3,500

for a total of $7800 in data transfer costs for S3. Versus $0 for R2. Note: if you were to move this workload to R2 from S3 you would pay a one-time egress fee of $90 (1 TB of storage). Also note that public access is not yet available for R2 so the GET requests would need to be routed through Workers.

In this scenario, R2 is 99% cheaper than S3.

Scenario 2: Document Cloud like Box

Now for a different type of asset and data access pattern. A document cloud would store PDFs, PowerPoints, media files, and other information for companies and governments. Many of these documents will be large and irregularly accessed. They could be stored for compliance purposes. For this use case, the average file size is 50 MB and 20K new files are added every month. Over time 500 TB of files have accumulated, of which 0.1% are accessed regularly.

For this access pattern, we can make use of S3 Storage Classes like “S3 Glacier Instant Retrieval” to store most of our data. We assume that 500 GB of will be available in the “S3 Standard - Infrequent Access” tier. These storage tiers are $0.005 per GB and $0.0138 per GB, respectively. Combined, the total cost is $2,504.40. For R2, there are no storage tiers, and this data costs $7,500 to store.

To POST and GET these files, it costs a little over $0.01 on each service so hardly worth considering. Data transfer fees for the 500 GB per month of downloads amount to $40 on S3.

For this scenario, S3 is 75% cheaper than R2.

Limitations of R2 compared to S3

S3 was 15 years old last year, and has been well stewarded, with continual improvements in automation, lower costs, and more granular access control. It shouldn’t cause any controversy to say that R2 will have many less features. And indeed CloudFlare goes out of their way to list every S3 API call that R2 is incompatible with. It might be the best current S3 API reference actually.

Cloudflare’s R2 compatibility with S3 guide [describes every API call](https://developers.cloudflare.com/r2/platform/s3-compatibility/api/), but most missing features are AWS specific security parameters.

S3 compatibility documentation from Cloudflare

On a feature-basis, the following current limitations stood out to us, but CloudFlare has suggested most of these features are in the works.

  • No public access
  • No bucket notifications (e.g. trigger a Lambda or Worker job)
  • No pre-signed URLs
  • No integration with Cloudflare’s cache
  • Limited to 1,000 GETs and 100 PUTs per second

Conclusion: (Object) Storage Wars

A wise man once described S3 as “malloc for the internet”. Its API and mental model are standard and there’s limited innovation to be done for GETs and PUTs. But changes in technology can mean that the infrastructure underneath an established API can radically change, and so can the pricing model.

Storage is the third overall cost category for cloud spend and Cloudflare is offering a dramatic alternative pricing model that can instantly result in savings for some workloads. We laid out in the same dimensions the pricing for R2 and S3, compared their free tiers, and then stepped through example workloads that could realize savings. In one application we could save 99% by using R2 while in a data archival use case we could save 75% with S3 due to its more advanced features.

Another exciting episode of (object) storage wars, concluded!