In 2021, Cloudflare announced R2, an S3-compatible object storage service with no data egress fees. No data transfer fees are 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.
We’ve been monitoring R2 developments since its announcement when we recognized R2 Private Beta as a large opportunity for savings. This blog was originally published in 2021, a few months after Open Beta and full pricing for R2 was announced but was updated on March 6, 2024, to account for recent S3 updates.
We compare pricing and functionality to discuss 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 73% 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 |
R2 Operation Type | Cost |
---|---|
Class A (PUT, POST, LIST) | $0.0045 per 1,000 |
Class B (GET, SELECT) | $0.00036 per 1,000 |
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.
Amazon S3 Pricing Breakdown
AWS says there are 6 cost components to S3, the Cloud Costs Handbook lists 28 storage classes, and between storage and transfer, there are 7 GB tiers for S3 Standard. With S3, you can configure the service to match your storage needs exactly—but there are always egress fees.
An extremely important caveat for the rates shown below is the 28 storage classes. They are all priced differently and AWS even has S3 Intelligent-Tiering, a cost automation service that 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 |
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 |
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 |
Comparing Free Tiers R2 vs S3
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. Another notable difference is that Amazon’s free tier is only applicable for 12 months.
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 |
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 Amazon storage limit. If each screen recording is downloaded 20 times 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 |
Example Scenarios R2 vs S3
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. Note—for simplicity sake in these scenarios, let’s assume the free tier quotas are used elsewhere in the applications.
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.
However, 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.
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 Intelligent-Tiering. We assume that 500 GB will be available in the Frequent Access Tier, 1.5 TB in the Infrequent Access Tier, and the rest in Archive Instant Access Tier. These storage tiers are $0.023 per GB, $0.0125 per GB, and $0.004 per GB, respectively. Combined, the total cost is $2022. 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 for each service so hardly worth considering. There are also S3 Intelligent-Tiering monitoring fees, which again are priced low and hardly worth considering. Data transfer fees for the 500 GB per month of downloads amount to $45 on S3.
For this scenario, S3 is 73% 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 fewer features. Indeed, CloudFlare goes out of its way to list every S3 API call that R2 is incompatible with. It might be the best current S3 API reference actually.
An example of a notable current limitation that exists for R2 is the no bucket notifications (e.g. trigger a Lambda or Worker job). Also, while R2 only has one storage tier, S3 has a variety of storage classes with different price-performance trade-offs.
Migrating from S3 to R2
Previously, to move out of S3 you would have to pay egress fees. In scenario 1, if you were to move that workload to R2 from S3, there would be a one-time egress fee of $90 (1 TB of storage). However, as of March 2024, there is free data transfer out to the internet when moving out of AWS. Cloudflare offers a service called Super Slurper, which makes it easy to copy objects from S3 to R2.
Conclusion: R2 vs S3 (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. However, 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 offers 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 data archival use cases, we could save 73% with S3 due to its more advanced features.
Another exciting episode of (object) storage wars, concluded!