AWS S3 vs Cloudflare R2 — A Comprehensive Comparison
Minh Khoa
Author
---
🎯 Introduction
In the world of cloud computing, object storage (object storage) is the backbone of almost every application — from storing images, videos, data backups, to serving static assets for websites.
The two most prominent names today are:
- Amazon S3 (Simple Storage Service) — the "king" of object storage, launched in 2006, and the oldest and most widely used service.
- Cloudflare R2 — the "challenger", launched in 2022, designed with the philosophy zero egress fees (free outbound bandwidth).
💡 Why is the name "R2"? Cloudflare named it R2 as a play on words — S3 subtract $1 = R2 — implying that R2 will help you save costs compared with S3!
🟠 Overview of AWS S3
S3 What is it?
Amazon Simple Storage Service (S3) is an object storage service (object storage) of AWSAmazon (99.999999999, providing unlimited storage capacity with extremely high data durability).
% — 11 nines
| Key characteristics | Characteristic |
|---|---|
| Details | 2006 |
| Launched (Durability) | 99.999999999% (Durability) |
| SLA 11 nines | 99.99% (Availability) |
| Standard | Storage Classes (8 types) |
| Standard, IA, Glacier, Deep Archive... | 30+ AWS Regions |
| API | S3 API (global Regions) |
| industry standard AWS | Integration EMRLambda, Athena, CloudFront... |
, Redshift, S3
┌─────────────────────────────────────────────────────────┐
│ AWS S3 Storage Classes │
├─────────────────────────┬───────────────────────────────┤
│ HOT (Truy cập thường) │ COLD (Truy cập hiếm) │
├─────────────────────────┼───────────────────────────────┤
│ S3 Standard │ S3 Glacier Instant Retrieval │
│ S3 Express One Zone │ S3 Glacier Flexible │
│ S3 Intelligent-Tiering │ S3 Glacier Deep Archive │
│ S3 Standard-IA │ │
│ S3 One Zone-IA │ │
└─────────────────────────┴───────────────────────────────┘
8 Storage Classes of
- S3 Explanation of each class: Standard (— Data that is accessed frequently CSS/JS).
- S3 product images, files Express One Zone (single-digit — Extremely high performance, extremely low latency).
- S3 Intelligent-Tiering ms
- S3 Standard-IA — Automatically moves objects between tiers based on access patterns. (— Infrequently accessed but needs to be retrieved quickly).
- S3 monthly backups Zone-IA One (— Similar to IA but stored in only 1 AZ).
- S3 cheaper, higher risk Glacier Instant (— Archive but retrieved instantly).
- S3 compliance data Glacier Flexible
- S3 — Archive retrieved in a few minutes to a few hours. Glacier Deep Archive 12-48 — The cheapest, retrieved in (hours 7-10 legal storage).
years R2
R2 🟡 Overview of Cloudflare
What is it? R2 Cloudflare (is an object storage service built on Cloudflare's global edge network. The main selling point): USP (NO egress charges).
outbound bandwidth
| Key characteristics | Details |
|---|---|
| Launch | 2022 |
| Durability (Durability) | Equivalent S3 (erasure coding + multi-DC replication) |
| SLA Availability | 99.9% |
| Storage Classes | 2 types (Standard, Infrequent Access) |
| Network | 300+ PoP (Points of Presence) global Cloudflare |
| API | S3-Compatible API |
| Integration | Cloudflare Workers, Pages, CDN |
Generous Free Tier
R2 offers a free tier no time limit:
- ✅ 10 GB free storage
- ✅ 1 million Class A operations (write/list) / month
- ✅ 10 million Class B operations (read) / month
- ✅ $0 egress — always free
Highlighted features (2026)
- Local Uploads (Beta): Write data to the nearest edge, automatically replicate to the main bucket — reduces upload latency by 75%.
- Data Catalog: Supports Iceberg-compatible catalog, query with DuckDB.
- Strong Consistency: Once written, it can be read immediately, with no eventual consistency.
⚔️ Detailed comparison
Overview comparison table
| Criteria | AWS S3 | Cloudflare R2 |
|---|---|---|
| Storage cost | ~$0.023/GB/month | ~$0.015/GB/month |
| Egress cost | $0.09/GB (first 10TB) | $0 (FREE) |
| Storage Classes | 8 types | 2 types |
| Availability SLA | 99.99% | 99.9% |
| Durability | 11 nines | High (multi-DC) |
| Free Tier | 5GB / 12 months | 10GB / forever |
| API | S3 Native | S3-Compatible |
| Lifecycle Policies | Very powerful & flexible | Basic (expiration) |
| Versioning | ✅ Full | ✅ Yes |
| Object Lock | ✅ | ❌ |
| Replication | Cross-Region, Same-Region | Automatic (in Cloudflare network) |
| Event Notifications | SNS, SQS, Lambda, EventBridge | Workers (Event Notifications) |
| Encryption | SSE-S3, SSE-KMS, SSE-C | AES-256 (default, always on) |
| Max Object Size | 5 TB | 5 TB |
| Multipart Upload | ✅ (max 10,000 parts) | ✅ (max 10,000 parts) |
| Rate Limits | Very high (3,500 PUT/s, 5,500 GET/s per prefix) | 1 write/s per key, 50 buckets ops/s |
Ecosystem comparison
AWS S3 Ecosystem:
┌──────────────────────────────────────────────────────────┐
│ S3 ←→ Lambda (Serverless compute) │
│ S3 ←→ CloudFront (CDN) │
│ S3 ←→ Athena (SQL query trực tiếp trên S3) │
│ S3 ←→ EMR / Redshift (Big Data / Data Warehouse) │
│ S3 ←→ SageMaker (Machine Learning) │
│ S3 ←→ Kinesis (Streaming) │
│ S3 ←→ Step Functions (Orchestration) │
│ S3 ←→ IAM (Fine-grained permissions) │
└──────────────────────────────────────────────────────────┘
Cloudflare R2 Ecosystem:
┌──────────────────────────────────────────────────────────┐
│ R2 ←→ Workers (Serverless compute at edge) │
│ R2 ←→ Cloudflare CDN (Built-in, tự động) │
│ R2 ←→ Pages (Static site hosting) │
│ R2 ←→ Queues (Message queue) │
│ R2 ←→ D1 (SQLite database at edge) │
│ R2 ←→ AI Gateway (AI inference) │
└──────────────────────────────────────────────────────────┘
💰 Detailed pricing table
AWS S3 Pricing (US East - N. Virginia)
| Item | Price |
|---|---|
| Storage (Standard) | $0.023/GB/month |
| Storage (Standard-IA) | $0.0125/GB/month |
| Storage (Glacier Instant) | $0.004/GB/month |
| Storage (Glacier Flexible) | $0.0036/GB/month |
| Storage (Deep Archive) | $0.00099/GB/month |
| PUT/COPY/POST/LIST | $0.005 / 1,000 requests |
| GET/SELECT | $0.0004 / 1,000 requests |
| Egress (First 10TB) | $0.09/GB |
| Egress (Next 40TB) | $0.085/GB |
| Egress (Next 100TB) | $0.07/GB |
Cloudflare R2 Pricing
| Item | Standard | Infrequent Access |
|---|---|---|
| Storage | $0.015/GB/month | $0.01/GB/month |
| Class A (write/list) | $4.50 / 1M requests | $9.00 / 1M requests |
| Class B (read) | $0.36 / 1M requests | $0.90 / 1M requests |
| Data Retrieval | Free | $0.01/GB |
| Egress | $0 | $0 |
🧮 Real-world cost example
Scenario 1: E-commerce website (E-commerce)
Context: An online shop stores 500GB of product images, serving 2TB bandwidth/thper month for customers to view products.
Cost with AWS S3:
Storage: 500 GB × $0.023 = $11.50
Egress: 2,000 GB × $0.09 = $180.00
Requests: 5M GET × $0.0004/1K = $2.00
────────────────────────────────────────
TỔNG: $193.50/tháng
Cost with Cloudflare R2:
Storage: 500 GB × $0.015 = $7.50
Egress: 2,000 GB × $0.00 = $0.00 ← MIỄN PHÍ!
Requests: 5M GET × $0.36/1M = $1.80
────────────────────────────────────────
TỔNG: $9.30/tháng
🔥 Savings: $184.20/month (95%) when using R2!
Scenario 2: SaaS Backup Storage (Cold data)
Context: A company SaaS needs to store 50TB of customer data backups, accessed very rarely (1-2 times/year), retained for at least 7 years by regulation.
Cost with AWS S3 Glacier Deep Archive:
Storage: 50,000 GB × $0.00099 = $49.50/tháng
Egress: ~0 (hiếm khi restore) = ~$0
────────────────────────────────────────
TỔNG: ~$49.50/tháng
Cost with Cloudflare R2 (Standard — because R2 there is no Glacier):
Storage: 50,000 GB × $0.015 = $750.00/tháng
Egress: ~0 = $0
────────────────────────────────────────
TỔNG: $750.00/tháng
⚠️ S3 Glacier Deep Archive is 15 times cheaper for cold storage! R2 is clearly worse in this use case.
Scenario 3: Streaming platform Video/Media Streaming
Context: A video platform has 10TB of content, serving 100TB bandwidth/thper month.
Cost with AWS S3 + CloudFront:
Storage: 10,000 GB × $0.023 = $230
Egress (S3): Miễn phí qua CloudFront
CloudFront: 100,000 GB × ~$0.085 = $8,500
────────────────────────────────────────
TỔNG: ~$8,730/tháng
Cost with Cloudflare R2:
Storage: 10,000 GB × $0.015 = $150
Egress: 100,000 GB × $0.00 = $0 ← MIỄN PHÍ!
Requests: 50M GET × $0.36/1M = $18
────────────────────────────────────────
TỔNG: $168/tháng
🔥 Savings: ~$8,500/month (98%)! This is the use case R2 shines brightest.
🔧 Practical code migration
From S3 to R2 — Extremely simple change
Because R2 using S3-Compatible API, you only need to change the endpoint:
JavaScript / Node.js (AWS SDK v3)
// ===== TRƯỚC: AWS S3 =====
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
const s3Client = new S3Client({
region: "ap-southeast-1",
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
},
});
// ===== SAU: Cloudflare R2 =====
const r2Client = new S3Client({
region: "auto", // R2 luôn dùng "auto"
endpoint: `https://${process.env.CF_ACCOUNT_ID}.r2.cloudflarestorage.com`,
credentials: {
accessKeyId: process.env.R2_ACCESS_KEY_ID,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
},
});
// Upload file — CODE HOÀN TOÀN GIỐNG NHAU!
async function uploadFile(bucketName, key, body) {
const command = new PutObjectCommand({
Bucket: bucketName,
Key: key,
Body: body,
ContentType: "image/png",
});
// Chỉ cần đổi s3Client → r2Client, xong!
return await r2Client.send(command);
}
Python (boto3)
import boto3
# ===== TRƯỚC: AWS S3 =====
s3_client = boto3.client('s3',
region_name='ap-southeast-1',
aws_access_key_id='YOUR_AWS_KEY',
aws_secret_access_key='YOUR_AWS_SECRET',
)
# ===== SAU: Cloudflare R2 =====
r2_client = boto3.client('s3',
endpoint_url=f'https://{ACCOUNT_ID}.r2.cloudflarestorage.com',
aws_access_key_id='YOUR_R2_KEY',
aws_secret_access_key='YOUR_R2_SECRET',
region_name='auto',
)
# Upload — code giống hệt!
r2_client.upload_file('local_file.jpg', 'my-bucket', 'images/photo.jpg')
# Download — code giống hệt!
r2_client.download_file('my-bucket', 'images/photo.jpg', 'downloaded.jpg')
# List objects — code giống hệt!
response = r2_client.list_objects_v2(Bucket='my-bucket', Prefix='images/')
for obj in response.get('Contents', []):
print(f" {obj['Key']} - {obj['Size']} bytes")
Data migration with Super Slurper
Cloudflare provides the tool Super Slurper right in the R2 Dashboard:
Các bước migration:
1. Vào Cloudflare Dashboard → R2 → Create Bucket
2. Chọn "Migrate from S3" → Nhập S3 credentials
3. Super Slurper sẽ tự động copy toàn bộ objects
4. Verify data → Đổi endpoint trong app → Done!
Migration with rclone (CLI)
# Cấu hình rclone
rclone config
# Tạo remote "s3" cho AWS S3
# Tạo remote "r2" cho Cloudflare R2
# Sync toàn bộ bucket
rclone sync s3:my-s3-bucket r2:my-r2-bucket --progress
# Verify
rclone check s3:my-s3-bucket r2:my-r2-bucket
🤔 When to choose S3? When to choose R2?
✅ Choose AWS S3 when:
- You have "all-in" with AWS ecosystem — Lambda triggers on file upload, Athena queries logs on S3, SageMaker training from S3 dataset.
- Need cold/archive storage — 50TB+ long-term backup data → Glacier Deep Archive only ~$0.001/GB/month.
- Need full compliance & certifications — HIPAA, SOC2, FedRAMP, PCI-DSS .
- Need complex lifecycle policies — Automatically move objects from Standard → IA → Glacier after X days.
- Need Object Lock — Immutable storage for regulatory compliance (WORM - Write Once Read Many).
- Egress is mainly internal — EC2 ↔ S3 within the same region = free egress.
✅ Choose Cloudflare R2 when:
- Serve public content — Images, videos, downloadable files for end users.
- High & unpredictable egress — Viral content, seasonal traffic spikes.
- Budget-conscious — Startup/indie dev needs maximum savings.
- Multi-cloud strategy — Don't want to be lock-in locked into 1 cloud provider.
- Already using Cloudflare — Workers, Pages, CDN → R2 naturally integrated.
- Global performance — Data is served from 300+ edge locations.
❌ Do NOT choose R2 when:
- Need to store tens of TB long-term archive data (Glacier is much cheaper).
- Application needs extremely fast writes to the same 1 object key (limited to 1 write/s/key).
- Need deep integration with AWS services (Lambda triggers, Athena queries).
- Need Object Lock / WORM compliance.
🔀 Hybrid strategy
Many companies use both to optimize costs:
┌─────────────────────────────────────────────────────────────┐
│ HYBRID ARCHITECTURE │
│ │
│ ┌──────────────┐ Public Assets ┌──────────────┐ │
│ │ │ (images, videos) │ │ │
│ │ Your App │ ─────────────────→ │ Cloudflare │ │
│ │ │ │ R2 │ │
│ │ │ Internal Data │ (Zero │ │
│ │ │ (backups, logs, │ Egress) │ │
│ │ │ ML datasets) └──────────────┘ │
│ │ │ ─────────────────→ ┌──────────────┐ │
│ │ │ │ AWS S3 │ │
│ │ │ │ (Glacier, │ │
│ └──────────────┘ │ Lambda, │ │
│ │ Athena) │ │
│ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
Real-world example:
// Hybrid upload strategy
async function uploadFile(file, type) {
if (type === 'public-asset') {
// Ảnh sản phẩm, avatar → R2 (zero egress)
return await r2Client.send(new PutObjectCommand({
Bucket: 'public-assets',
Key: `images/${file.name}`,
Body: file.buffer,
}));
} else if (type === 'backup') {
// Database backup → S3 Glacier (rẻ nhất)
return await s3Client.send(new PutObjectCommand({
Bucket: 'backups',
Key: `db/${Date.now()}_backup.sql.gz`,
Body: file.buffer,
StorageClass: 'DEEP_ARCHIVE',
}));
}
}
Both AWS S3 and Cloudflare R2 both charge you based on 3 main fees:
- Space rental fee (Storage Fee): Charged by the amount of goods (Data) you store in the warehouse.
- Warehouse staff fee (Operations/Requests Fee): Charged by the number of times you mistakenly have staff carry goods into the warehouse (Upload) or take goods out of the warehouse to view them (Download).
- Outbound shipping fee (Egress/Data Transfer Fee): Charged by the quantity of goods transported out of the warehouse and delivered to customers (users on the network download).
Now let’s compare each item in detail:
1. Space rental fee (Storage)
How much does storing data cost?
- Cloudflare R2: There are only 2 simple price tiers:
- Standard storage (Standard): $0.015 / GB per month.
- AWS S3: There are many types of "warehouses" with different prices depending on your needs:
- Standard warehouse (S3 Standard - most commonly used): $0.023 / GB per month (more expensive R2 a little).
- Cold storage (Glacier Deep Archive - used to store things you don’t use)unbelievably cheap, only $0.00099 / GB per month (cheaper R2 by a lot, but taking things out will incur a penalty fee and take a very long time).
2. Warehouse staff fee (Operations / Requests)
Each time you Upload (Write) or Download (Read) how much does it cost?
- Cloudflare R2:
- Write fee (Class A - Upload/List): $4.50 for each 1 million calls.
- Read fee (Class B - Download): $0.36 for each 1 million calls.
- Specially: R2 given free every month: 1 million Write operations and 10 million Read operations!
- AWS S3:
- Write fee (PUT/COPY...): $5.00 for each 1 million calls.
- Read fee (GET/SELECT...): $0.40 for each 1 million calls.
- S3 does not have a generous perpetual free plan like R2.
(Overall, this fee on both sides is very cheap, and usually is not a big issue unless your system has billions of visits per day).
3. Internet outbound shipping fee (Egress Fee) - 🚨 THIS IS THE BIGGEST DIFFERENCE
How much does it cost when users download your file?
- Cloudflare R2: COMPLETELY FREE ($0). No matter whether your data is downloaded 1 GB or 100,000 GBtimes, you do not have to pay any extra for outbound bandwidth.
- AWS S3: Very expensive. AWS charges about $0.09 for each 1 GB of data transferred out of their storage (for the first 10TB).
💡 A SPECIFIC EXAMPLE PROBLEM TO HELP YOU UNDERSTAND EASILY:
Suppose you are building a movie streaming website. You have 1,000 GB movies (Storage). In one month, your customers watch movies and download a total of 10,000 GB (Egress).
If you use Cloudflare R2:
- Space rental fee (1,000 GB x $0.015): $15.00
- Shipping fee (10,000 GB download): $0 (Free)
- TOTAL: ~$15.00 / month
If you use AWS S3:
- Space rental fee (1,000 GB x $0.023): $23.00
- Shipping fee (10,000 GB x $0.09): $900.00 😱
- TOTAL: ~$923.00 / month
📊 Quick summary
| Criterion | Winner |
|---|---|
| Egress cost | 🏆 R2 (completely free) |
| Storage cost (hot) | 🏆 R2 ($0.015 vs $0.023) |
| Storage cost (cold) | 🏆 S3 (Glacier: $0.001/GB) |
| Ecosystem & integrations | 🏆 S3 (AWS huge services) |
| Free tier | 🏆 R2 (10GB forever) |
| Availability SLA | 🏆 S3 (99.99% vs 99.9%) |
| Storage classes | 🏆 S3 (8 vs 2) |
| Global edge performance | 🏆 R2 (300+ PoPs Cloudflare) |
| Compliance | 🏆 S3 (HIPAA, FedRAMP...) |
| Easy migration | 🤝 Tie (S3-compatible API) |
🎯 Conclusion
There is no "absolute winner" — only the choice that fits your use case.
- You are startup/indie dev serving content for users? → R2 will save thousands of dollars each month.
- You are an enterprise with a complex data pipeline on AWS? → S3 is still king.
- You want the best optimization? → Use both according to a hybrid strategy.
The most important thing: R2 has broken the monopoly of "egress tax" — and that forces both AWS and GCP to lower egress prices. The final beneficiaries are us — developers.
📝 Note: The prices in this article are based on publicly available information as of month 7/2026. Please check the official pricing pages of AWS S3 and Cloudflare R2 for the latest information.