The Blog

The Compelling Economics of Cloudflare R2

Calendar Icon 10.06.2021
aws-section-divider aws-section-divider

Cloudflare announced its own object storage offering last week, snarkily naming it “R2” instead of AWS’ “S3.” Storage is great, but let’s tie it to cloud economics here. We don’t have specifics as to edge case pricing dimensions, but Cloudflare’s blog post goes into some detail about how it works.

First, it charges a rate of 1.5¢ per GB per month. In contrast, AWS’ tier 1 region pricing is 2.3¢ per GB per month. This is a 35% cut for storage pricing, which is not insignificant.

Next, Cloudflare intends to “zero rate” its request charge until you’re making double-digit requests per second. That’s interesting, but there’s no detail provided here, so I’m going to ignore it.

Lastly, R2’s data egress fee is $0. AWS’ data egress starts at 9¢ per gig, then decreases with larger volumes. Let me repeat that for any AWS employees who happen to be reading this: Data egress with Cloudflare is free.

Just to avoid the Amazonian knives I’m sure will be coming my way for this post though: You get 5GB of free S3 storage for the first 12 months the account is open, and the first 1GB of data transfer egress is always free.

It’s also worth noting that Cloudflare offers an “S3 proxy” of sorts; you can drop this in front of S3 or, frankly, any S3-compatible object store, which is effectively all of them. And suddenly the fun begins.

Corey, this is boring and esoteric

Yes, yes it is. Let’s do some examples here. We’re going to ignore AWS’ free tier, because if you trust it, you’re doomed anyway. We’re also going to assume us-east-1 or us-west-2 for pricing purposes.

Scenario 1: A 1GB object on S3 and R2

I slap a 1GB object into S3 and make it available via S3’s static site hosting. (I could use its CloudFront offering, but data egress is usually more expensive if I do that, not less). If exactly one person downloads it this month, I pay 11.3¢: 2.3¢ for the storage, 9¢ for the transfer.

I also slap a 1GB object into R2 and make it available via Cloudflare’s free plan. Note that I have many domains using its free plan today, including duckbillgroup.com. It’s a very legitimate offering. That costs me 1.5¢ for the month just for the storage. Remember, egress is free. The same person downloads the object exactly once.

Scenario 1: Final costsAWS: 11.3¢Cloudflare: 1.5¢

Scenario 2: A 1TB object on S3 and R2

One of the problems I have with cloud pricing is that it’s hard to reason about small numbers. Let’s multiply everything by a thousand and rerun the scenario above with a 1TB object living in each cloud store. Again, we assume it transfers to the internet exactly once with zero compression.

Scenario 2: Final costsAWS: $113Cloudflare: $15

Scenario 3: A 1GB object with S3 proxy

Let’s pretend that I don’t trust Cloudflare to store my data reliably — they’re network people, not storage people! I can accept that argument. As a grumpy old sysadmin, I’m distrustful of stateful things at launch. New file systems, storage solutions, or databases bear careful watching, and I won’t be the first kid on my block to trust them.

This is where I’d use Cloudflare’s S3 proxy feature. I’d point Cloudflare at my S3 bucket and wait. When the first request for my 1GB object comes in, Cloudflare would copy the object into R2 and serve it from there. In this case, I pay AWS’ data transfer rate of 9¢ to get it to R2, S3’s storage fee of 2.3¢, and R2’s storage fee of 1.5¢, for a total of 12.8¢.

Scenario 3: Final costsCloudflare with their D2 proxying S3: 12.8¢ (all but 1.5¢ of this is AWS charges)

Scenario 4: A 1TB object with S3 proxy

And of course, let’s do this times a thousand to make the numbers make more sense. When everything becomes a terabyte, I pay $90 in AWS egress fees, $23 in AWS storage fees, and $15 in Cloudflare storage fees, for a total of $128.

Note that if I’m only ever accessing S3 data the first time or when R2 breaks, there’s no reason for me not to use S3’s infrequent access storage class. This adds a 1¢ per GB surcharge to retrieval requests (call it part of the egress fee), and raises this scenario’s costs to $100 in AWS egress fees, $12.50 in S3 storage fees, and $15 in Cloudflare storage fees, for a total of $127.50 in total charges the first month. If this object gets accessed again in the second month, my fees are just $27.50.

Scenario 4: Final costsCloudflare with S3 proxy: $128 OR $127.50 the first month and $27.50 after that

Scenario 5: A wildly viral or terribly misconfigured 1GB object

Let’s get wild with this last scenario, because it most clearly highlights the game-changing element of what Cloudflare’s release means.

I put up a 1GB object, and for some reason it goes incredibly viral (or I misconfigure a script somewhere, which, let’s face it, is far likelier). That 1GB object gets accessed a million times.

My pure Cloudflare cost for this is 1.5¢ for the storage, $0 for the transfer.

If I use Scenario 4’s blended model with the S3 proxy, my total cost is 12.3¢.

And if I’m entirely on AWS, the S3 charges are 2.3¢ per month, while the data egress charges get tricky. It drops down in bracketed tiers, so above 150TB it costs 5¢ per GB. And the data egress cost would be $53,891.16, for a total cost of $53,891.18, assuming AWS is charitable enough to drop the fraction of a penny. And that is why this changes the game for data egress charges to the internet with AWS.

Scenario 5: Final costsAWS: $53,891.18Cloudflare with S3 proxy: 12.3¢Cloudflare: 1.5¢

Frequently Shouted Questions

Why’s it matter, since nobody pays retail rate for 1PB of data egress on AWS?

You’re right, no one pays retail for 1PB! Even AWS’ data transfer page says to get in contact with them for transfer volumes above 500TB a month. That’s all well and good for month two; that discounting is going to depend upon committing to do this every month for at least a year.

Assuming a 50% discounting rate on that 1PB and you intend to commit for the year, that drops you down to $26,945.58 for the Scenario 5 data transfer charge. Still not terrific! We’re going from “new BMW” to “stripped-down Toyota” pricing here.

Let’s also not lose sight of the fact that “I just got surprised by a 1PB egress bill” means that yes, I’m very much being charged retail pricing for it.

You really think Cloudflare is going to let you do a petabyte of data egress on a free account?

Maybe! Maybe not!

I do know that I’ll get a phone call with a salesperson who wants to talk about selling me an enterprise offering. With AWS, I’ll get a bill via email that, in the event of my misconfigured script, will trigger a heart attack. Then I get the option to pony up, beg for a concession, or prepare to be sent to collections. See, a whole lot of AWS customers do multiple petabytes of data egress every day; this isn’t really a blip to them.

How in the world will Cloudflare stay in business?

The short answer is “by selling services for more than it costs to provide them.” As of its most recent quarterly report, Cloudflare has 77% gross margins.

I regret to inform you that you’ve been misled: The way that companies buy and sell bandwidth is complicated and arcane. Cloudflare touches on a lot of it in an older blog post that gets into transit, peering, 95th percentile billing, etc.

Effectively, instead of paying by the gigabyte, companies (including AWS) pay by the gigabit per second utilization of links to other networks. In AWS’ Egregious Egress from this past summer, Cloudflare does a bunch of math to show that AWS is at minimum charging an 80x markup in the U.S. for data transfer. This of course assumes that Amazon (motto: “We’re cheap but call it Frugal!”) can’t negotiate better rates than Cloudflare can. I very much doubt that to be true.

So far, R2 gives S3 some real competition — and customers can really save

I’m very pleased by this development. I think it throws a major wrench into AWS’ excessive egress charges, and it opens up a whole bunch of opportunities for customers. With Cloudflare Workers and a bunch of other services that Cloudflare is busy rolling out, there’s starting to be a strong economic incentive to move certain workloads to its platform. Data gravity is real; “where your data lives” is usually with the provider that starts to see a lot of your other workloads as well.

All of this is, of course, subject to change. We don’t have complete pricing dimensions for R2 yet, nor have we seen terms of service. But this does make it very clear that AWS is either going to have to address its egress fees or risk losing workloads as the patterns I’ve described solidify into best practices.

aws-section-divider