Cloudflare R2 vs Amazon S3: Storing and Serving Product Media
Product media is read far more often than it is written, which makes egress the line item that surprises commerce teams. Cloudflare R2 and Amazon S3 take opposite positions on that cost and on how deeply they plug into the rest of your stack. Here is how to decide where your images and video should live.
A commerce catalog is a strange storage workload. You upload a product photo once and serve it millions of times. Every product page, search result, email, marketplace feed and social ad pulls the same bytes again. Storage itself is cheap; delivery is where the bill grows. That asymmetry is the single most important fact when choosing where product media lives.
Amazon S3 is the default answer and has been for fifteen years. Cloudflare R2 arrived with a pointed pitch: S3 compatible storage with no charge for egress. The right choice depends on how your traffic flows, what else runs in your cloud, and which compliance boxes you have to tick. This post walks through the decision the way we would for a client.
Why Egress Is the Whole Conversation
Object storage pricing has three components: the bytes stored, the operations performed (reads, writes, lists), and the bytes transferred out to the internet. For a media heavy storefront, the third dominates. Serve a few megabytes of imagery on every page view across millions of views and the transfer bill outgrows the storage bill by a wide margin.
The pricing models differ in kind, not just in rate. S3 charges for data transferred out to the internet beyond a free allowance, with rates that vary by region and volume tier. S3 also charges per request, and transfers between regions or out to other services carry their own fees. R2 charges for storage and for operations, split into classes, but does not charge for egress bandwidth. That is the entire structural difference.
I am deliberately not quoting dollar figures here, because rates change, free tiers change, and regional pricing varies. Check each provider's current pricing page and run your own numbers with real traffic. The method matters more than any number in a blog post: estimate stored gigabytes, monthly reads and the average object size delivered, then price both models. Illustrative example: a catalog with a modest storage footprint but heavy traffic will see the egress line dominate on S3 and nearly vanish on R2, while a catalog that is mostly archive with little traffic will see the two converge, and S3's cheaper cold tiers may win outright.
One caveat applies to both. Most serious storefronts do not serve directly from the bucket at all. They put a CDN in front, and the CDN absorbs most reads. With S3 behind a CDN you pay S3 egress only on cache misses to the origin, which narrows the gap considerably. R2 does not eliminate the CDN question either; it changes the cost of the misses.
S3 API Compatibility: Mostly Seamless, Not Identical
R2 exposes an S3 compatible API, which is the reason migration is realistic. Existing SDKs, upload tools, presigned URLs and most libraries work by pointing the endpoint at R2 and swapping credentials. For a team with upload code, a DAM integration or a build pipeline already speaking S3, this is a configuration change, not a rewrite.
Compatibility is broad but not total. S3 has accumulated fifteen years of features: object versioning behaviors, event notifications wired to Lambda, replication rules, object lock, several storage classes, inventory reports, access points, and a deep policy language through IAM. R2 covers the core object operations and has its own approach to some of the rest, such as using Workers for event driven logic rather than native bucket notifications. Before you commit, audit the exact S3 features your systems call. The surprises are rarely in PutObject and GetObject. They are in lifecycle rules, multipart edge cases, and tooling that quietly assumes an AWS only feature.
The compatibility also runs one way. You can move media to R2 with the same code, but anything that depends on S3 as an event source or as a native input to other AWS services does not come along for free.
Ecosystem Depth: Where S3 Is Hard to Beat
S3 is not just storage; it is the center of gravity of the AWS ecosystem. Lambda triggers on upload, Rekognition for image analysis, MediaConvert for video transcoding, Glue and Athena for querying inventory data, CloudFront with origin access controls, Macie for sensitive data discovery, and cross region replication for disaster recovery all treat S3 as a first class citizen. If your commerce stack already lives in AWS, with order processing, search, personalization and data warehousing nearby, the integration value of S3 is real and hard to replicate.
R2's ecosystem is the Cloudflare ecosystem, and it is strong in a different place: the edge. Workers can read and write buckets with very low latency, the CDN and cache sit in the same network, and image resizing, caching rules and security features are configured in one control plane. For a storefront already deployed on Cloudflare, or one leaning toward edge rendering, R2 feels native. We cover that deployment landscape in our comparison of Cloudflare Workers and Vercel Edge Functions.
Image Transformation Pipelines
Raw uploads are never what you serve. Product images need responsive sizes, modern formats such as WebP and AVIF, cropping for different layouts, and sometimes watermarks or background handling. There are three common patterns.
The first is transform on upload: a function generates a fixed set of variants and writes them back to the bucket. On S3 that is a Lambda triggered by the upload event. On R2 it is typically a Worker or an external service, since the event model differs. This is simple and cheap to serve, but inflexible when design changes the sizes you need.
The second is transform on demand at the CDN or edge: a request for a specific size and format is resolved by a transformation layer, then cached. On AWS that usually means CloudFront with a Lambda or a purpose built image handler. On Cloudflare it means the platform's image transformation features or a Worker. Both are capable; check current pricing and limits for transformation, as billing is separate from storage.
The third is delegating to a specialist such as Cloudinary or imgix, with your bucket as the origin. This is often the best answer when marketing needs rich transformations without engineering tickets. We compare those options in Cloudinary versus imgix versus Shopify CDN for headless image infrastructure. In that setup, the storage choice matters mainly for origin fetch cost, which is exactly where R2's pricing model helps.
CDN Integration and Cache Behavior
S3 pairs naturally with CloudFront, and it also works behind any other CDN, though you will pay S3 egress on every miss. R2 pairs naturally with Cloudflare's CDN, where serving from R2 through the cache avoids per byte transfer charges, and also works behind third party CDNs through its public endpoint or custom domains.
Whichever you pick, the operational rules are the same. Use content addressed or versioned filenames so you can set long cache lifetimes safely and never need to purge. Set explicit cache control headers at upload time. Keep originals separate from derived variants so a transformation change never risks the source of truth. For the cache invalidation side of the problem, see our guide to on demand ISR and webhook purges in headless commerce.
Durability, Compliance and the Boring Questions That Decide Deals
This is where enterprise buyers often override cost arguments. S3 publishes a very high durability design target, offers multiple storage classes, versioning, object lock for write once retention, replication across regions and accounts, and a long list of compliance attestations and audit tooling. Fine grained access control through IAM, bucket policies, access logs and CloudTrail data events is mature and understood by every auditor.
R2 is built on Cloudflare's network with its own durability and security claims, and it has a growing set of features such as location hints and jurisdictional restrictions for data placement. For many commerce workloads that is enough. For some, it is not: if you need specific retention locks, a particular certification scope, tight integration with an existing AWS governance program, or a contractual position your legal team already approved for AWS, S3 is the lower friction path. Verify current certifications and feature availability on both vendors' trust pages rather than relying on any summary. Product images are rarely regulated data, but your bucket may also hold invoices, exports and customer uploads, so decide whether those belong in the same place.
The Decision Framework
| Dimension | Cloudflare R2 | Amazon S3 |
|---|---|---|
| Egress model | No egress bandwidth charge | Metered egress with tiers |
| Storage tiers | Fewer options | Many classes, deep archive |
| API | S3 compatible, core features | The original and complete |
| Event triggers | Via Workers and Cloudflare tools | Native bucket notifications |
| Best CDN pairing | Cloudflare | CloudFront |
| Ecosystem | Edge compute, Cloudflare platform | Broad AWS services |
| Compliance tooling | Growing | Extensive and familiar to auditors |
| Best for | Read heavy public media | Regulated, integrated or archive heavy data |
Choose R2 when your media is public, read heavy and served at meaningful volume, when your storefront or CDN already runs on Cloudflare, when egress is a visible line item, or when you want to avoid being locked into a single hyperscaler's transfer pricing. It is also an attractive origin for a multi CDN strategy.
Choose S3 when your commerce stack is deeply AWS based, when you rely on event driven processing and AWS native services, when you need object lock, replication or advanced lifecycle management, or when compliance and procurement already favor AWS.
A hybrid is common and sensible: keep originals and sensitive assets in S3 under strict governance, replicate or publish delivery copies to R2 behind a CDN. The cost is operational complexity, so only do it if the egress savings justify a second system.
What This Means for Your Business
Media delivery cost scales with success. The better your marketing performs, the more bytes you serve, and a pricing model with metered egress turns growth into a rising infrastructure bill. Moving high traffic public media to a no egress model can change the shape of that curve, but only if the CDN layer, transformation costs and request fees are modeled honestly, because they remain.
There is also a performance angle. Faster image delivery improves page speed, which feeds conversion and search visibility. The storage backend matters less than cache hit rate, image format and sizing discipline, so do not migrate buckets expecting a speed miracle. Migrate for cost structure and architectural fit, and invest separately in the transformation pipeline.
Finally, treat migration as a project with a rollback plan. Copy data, dual read through a fallback, compare costs for a full billing cycle, then cut over. The S3 compatible API makes this easier than most infrastructure moves, which is the real strategic benefit: lower switching cost in both directions.
How Contra Collective Bridges the Gap
We model media delivery costs with real traffic data, design transformation and CDN layers for headless storefronts, and run storage migrations with dual read safety nets so launches are never at risk. Whether the answer is R2, S3 or a hybrid, we will show the math before you commit. Talk to our team if your image and video bill is growing faster than your revenue.
Final Thoughts
Cloudflare R2 and Amazon S3 are both excellent object stores that make opposite bets. R2 bets that egress should not be a tax on read heavy workloads, and wins when your media is public, popular and close to Cloudflare's network. S3 bets on depth, and wins when governance, integration and a broad AWS ecosystem matter more than transfer pricing. Model your own traffic, verify current rates, audit the S3 features you actually use, and keep your originals portable. The best storage decision is the one that is cheap to reverse.
More from the lab.
Redis vs Valkey: Caching for High Traffic Storefronts
In March 2024 Redis changed its license and the Linux Foundation answered with Valkey, a BSD licensed fork backed by the big cloud vendors. For most storefront teams the real question is not ideology but whether switching saves money or removes risk. Here is how to decide.
BigCommerce Catalyst Native Hosting on Cloudflare: What Composable Commerce Teams Need to Know
BigCommerce announced at Commerce Live 2026 that Native Hosting for Catalyst, its headless storefront framework, is moving to open beta on Cloudflare in summer 2026, managed through a CLI with log retention and custom domain support included at no additional cost. That is a direct answer to the question every team building on Catalyst eventually asks: who hosts this, and what does it cost once it is not a demo anymore. Here is what the announcement actually commits to and where the gaps still are.
What Black Friday 2026's AI Shopping Numbers Actually Mean for Headless Merchants
Two vendor forecasts for the 2026 holiday season put a number on something most merchants have felt but not quantified. Salesforce projects that 20 percent of all 2026 holiday ecommerce traffic will come from AI chat agents, consumer bots, autonomous backend agents, and competitor price scrapers combined, and that one in three ecommerce sites will have a live, site specific shopper agent by Cyber Week. Infobip separately projects more than 7.3 billion customer interactions across Black Friday and Cyber Monday 2026, with 63.2 percent of consumers reporting they used an AI assistant or chatbot while shopping in the past year. Neither number is a reason to panic. Both are a reason to check whether your storefront's infrastructure can actually serve a non human visitor as well as it serves a human one.