TECH_COMPARISON
S3 vs R2: A Detailed Comparison for System Design
Compare AWS S3 and Cloudflare R2 for object storage — covering pricing, egress fees, performance, compatibility, and when to use each.
S3 vs Cloudflare R2
AWS S3 is the industry standard for object storage. Cloudflare R2 is a newer S3-compatible alternative that eliminates egress fees. S3 wins on features and ecosystem. R2 wins on cost for egress-heavy workloads.
The Egress Fee Problem
S3's biggest pain point is egress pricing. Transferring data out of S3 costs $0.09/GB for the first 10 TB/month. For applications serving terabytes of media, assets, or downloads, egress often exceeds storage costs by 10x or more.
R2 charges zero egress fees. Store data in R2 and serve it through Cloudflare's global network — no data transfer charges regardless of volume. This changes the economics of object storage fundamentally.
Storage Feature Comparison
S3's feature depth is unmatched. Storage classes let you move infrequently accessed data to cheaper tiers automatically. Glacier and Deep Archive provide pennies-per-GB archiving. S3 Intelligent-Tiering automates tier selection. Lifecycle policies manage object transitions and expiration.
R2 offers a single storage class at $0.015/GB/month. No tiering, no archiving, no lifecycle policies. This simplicity works for many use cases but is limiting for data with varied access patterns.
Ecosystem Integration
S3 is the storage backbone of AWS. Lambda triggers on S3 events. Athena queries S3 data with SQL. EMR processes S3 data at scale. Redshift Spectrum extends queries to S3. Over 100 AWS services integrate natively.
R2 integrates with Cloudflare Workers — serverless functions at the edge that can process R2 objects. The ecosystem is smaller but growing.
Migration Path
R2's S3 API compatibility means most S3 tooling works with R2. You can use aws-cli (with custom endpoint), boto3, or any S3 SDK. Migrating data is straightforward with tools like rclone.
For system design interviews, understanding S3 vs R2 shows cost-aware architecture. See also: storage patterns, CDN architecture, and pricing analysis.
GO DEEPER
Master this topic in our 12-week cohort
Our Advanced System Design cohort covers this and 11 other deep-dive topics with live sessions, assignments, and expert feedback.