Cloudflare R2 vs. AWS S3: Egress Cost, Performance & TCO Comparison
For data-intensive workloads—such as video streaming, software artifact distribution, ML dataset hosting, and public SaaS media delivery—AWS S3 storage ($0.023/GB-month) is rarely the largest line item on the cloud bill. Instead, outbound data transfer (egress) fees ($0.09/GB to the public internet) routinely account for 70% to 90% of total object storage spend, creating severe vendor lock-in whenever an organization wants to move petabytes of data across clouds or multi-CDN setups.
Cloudflare R2 eliminates outbound bandwidth fees entirely ($0.00/GB egress) while exposing an S3-compatible REST API, allowing engineering teams to switch storage backends with minimal code changes. However, R2 is not universally cheaper for every workload: its higher per-request operation pricing and lack of deep cold-storage tiers mean high-IOPS, low-egress pipelines behave very differently from bandwidth-heavy workloads.
Cloudflare R2 vs. AWS S3: Pricing & Architectural Comparison
Comparing baseline us-east-1 AWS S3 Standard pricing against Cloudflare R2 Standard pricing highlights the exact trade-offs between storage, operations, and bandwidth:
| Cost & Architecture Dimension | AWS S3 Standard (us-east-1) | Cloudflare R2 Standard | FinOps & Engineering Impact |
|---|---|---|---|
| Outbound Egress Bandwidth | $0.09 / GB (first 10 TB/mo, tiered down to $0.05/GB) | $0.00 / GB (Zero egress fees globally) | R2 eliminates the #1 cost driver for media, downloads, and cross-cloud data sharing |
| Standard Storage Cost | $0.023 / GB-month (first 50 TB) | $0.015 / GB-month (10 GB free tier included) | R2 base storage is ~35% cheaper than S3 Standard |
| Class A Operations (Writes) | $0.005 per 1,000 requests (PUT, COPY, POST, LIST) | $4.50 per 1,000,000 requests ($0.0045 / 1k; 1M free/mo) | Nearly identical (~10% cheaper on R2) |
| Class B Operations (Reads) | $0.0004 per 1,000 requests (GET, SELECT, HEAD) | $0.36 per 1,000,000 requests ($0.00036 / 1k; 10M free/mo) | Nearly identical (~10% cheaper on R2) |
| Cold / Archival Storage Tiers | Glacier Instant / Flexible / Deep Archive ($0.00099–$0.004/GB) | Infrequent Access ($0.01/GB + $0.01/GB retrieval); no Deep Glacier tier | AWS S3 wins decisively for cold compliance archives (< $0.004/GB) |
| Region & Replication Model | Explicit regional buckets + paid Cross-Region Replication (CRR) | Automatic global edge routing + optional Jurisdictional Restrictions (EU/FedRAMP) | S3 gives granular VPC/AZ placement; R2 simplifies global edge delivery |
| Minimum Object / Storage Duration | 0 days (Standard); 90–180 days (Glacier tiers) | 0 days (Standard); 30 days (Infrequent Access) | No early-deletion penalties on R2 Standard |
+-----------------------------------------------------------------------------------+
| EGRESS COST BOTTLENECK: AWS S3 vs. CLOUDFLARE R2 |
+-----------------------------------------------------------------------------------+
| |
| TRADITIONAL AWS S3 ARCHITECTURE (Egress Tax Multiplies at Scale) |
| +------------------+ $0.09/GB Egress +-----------------------------------+ |
| | AWS S3 Bucket | -------------------> | External Users / Multi-CDN / GCP | |
| | (50 TB @ $1,150) | (100 TB = $9,000) | Total Monthly Bill: ~$10,150/mo | |
| +------------------+ +-----------------------------------+ |
| |
| CLOUDFLARE R2 ARCHITECTURE (Zero Egress + S3-Compatible API) |
| +------------------+ $0.00/GB Egress +-----------------------------------+ |
| | Cloudflare R2 | ===================> | External Users / Cloudflare CDN | |
| | (50 TB @ $750) | (100 TB = $0.00) | Total Monthly Bill: ~$750/mo | |
| +------------------+ +-----------------------------------+ |
+-----------------------------------------------------------------------------------+
TCO & Break-Even Modeling in Python (tco_calculator.py)
To evaluate whether migrating a workload from AWS S3 to Cloudflare R2 makes financial sense, model storage volume, monthly egress bandwidth, and Class A/B API request counts simultaneously. The Python FinOps simulator below calculates exact monthly bills across four realistic cloud workload profiles:
from dataclasses import dataclass
@dataclass(frozen=True)
class WorkloadProfile:
name: str
storage_gb: float
monthly_egress_gb: float
class_a_requests: int # PUT, POST, LIST, COPY
class_b_requests: int # GET, HEAD
def calculate_aws_s3_monthly_cost(w: WorkloadProfile) -> float:
# S3 Standard Storage (us-east-1 tiered pricing)
if w.storage_gb <= 51_200:
storage_cost = w.storage_gb * 0.023
else:
storage_cost = (51_200 * 0.023) + ((w.storage_gb - 51_200) * 0.022)
# S3 API Operations
class_a_cost = (w.class_a_requests / 1_000) * 0.005
class_b_cost = (w.class_b_requests / 1_000) * 0.0004
# S3 Outbound Internet Egress (first 100 GB free, next 9.9 TB @ $0.09, next 40 TB @ $0.085, >50 TB @ $0.07)
billable_egress = max(0.0, w.monthly_egress_gb - 100.0)
egress_cost = 0.0
tiers = [(10_140.0, 0.09), (40_960.0, 0.085), (102_400.0, 0.07), (float("inf"), 0.05)]
remaining = billable_egress
for tier_gb, rate in tiers:
chunk = min(remaining, tier_gb)
egress_cost += chunk * rate
remaining -= chunk
if remaining <= 0:
break
return round(storage_cost + class_a_cost + class_b_cost + egress_cost, 2)
def calculate_cloudflare_r2_monthly_cost(w: WorkloadProfile) -> float:
# R2 Standard Storage ($0.015/GB after 10 GB free tier)
storage_cost = max(0.0, w.storage_gb - 10.0) * 0.015
# R2 Class A ($4.50/million after 1M free) & Class B ($0.36/million after 10M free)
billable_a = max(0, w.class_a_requests - 1_000_000)
billable_b = max(0, w.class_b_requests - 10_000_000)
class_a_cost = (billable_a / 1_000_000) * 4.50
class_b_cost = (billable_b / 1_000_000) * 0.36
# R2 Zero Egress Bandwidth
egress_cost = 0.0
return round(storage_cost + class_a_cost + class_b_cost + egress_cost, 2)
if __name__ == "__main__":
scenarios = [
WorkloadProfile("1. SaaS Media & Video Delivery", storage_gb=20_000, monthly_egress_gb=100_000, class_a_requests=2_000_000, class_b_requests=80_000_000),
WorkloadProfile("2. Open-Source / AI Model Weights Host", storage_gb=5_000, monthly_egress_gb=250_000, class_a_requests=50_000, class_b_requests=15_000_000),
WorkloadProfile("3. High-IOPS Telemetry Ingestion", storage_gb=10_000, monthly_egress_gb=500, class_a_requests=150_000_000, class_b_requests=200_000_000),
WorkloadProfile("4. Internal EC2 Data Lake (Same-Region)", storage_gb=100_000, monthly_egress_gb=0, class_a_requests=10_000_000, class_b_requests=50_000_000),
]
print(f"{'Workload Profile':<40} | {'AWS S3 ($/mo)':>14} | {'R2 ($/mo)':>12} | {'Monthly Savings':>16}")
print("-" * 92)
for item in scenarios:
s3_bill = calculate_aws_s3_monthly_cost(item)
r2_bill = calculate_cloudflare_r2_monthly_cost(item)
savings = s3_bill - r2_bill
pct = (savings / s3_bill * 100) if s3_bill > 0 else 0
print(f"{item.name:<40} | ${s3_bill:>12,.2f} | ${r2_bill:>10,.2f} | ${savings:>10,.2f} ({pct:4.1f}%)")
Representative TCO Output
Workload Profile | AWS S3 ($/mo) | R2 ($/mo) | Monthly Savings
--------------------------------------------------------------------------------------------
1. SaaS Media & Video Delivery | $ 8,473.20 | $ 329.55 | $ 8,143.65 (96.1%)
2. Open-Source / AI Model Weights Host | $ 18,176.25 | $ 76.65 | $ 18,099.60 (99.6%)
3. High-IOPS Telemetry Ingestion | $ 1,103.10 | $ 888.75 | $ 214.35 (19.4%)
4. Internal EC2 Data Lake (Same-Region) | $ 2,320.00 | $ 1,549.35 | $ 770.65 (33.2%)
Drop-In S3-Compatible Integration with Python (r2_storage_client.py)
Because Cloudflare R2 implements the AWS S3 API (Signature Version 4), existing applications using boto3, AWS SDKs, rclone, or Terraform require only an endpoint_url override and region_name="auto":
import os
import boto3
from botocore.config import Config
def get_r2_client():
account_id = os.environ["CF_ACCOUNT_ID"]
return boto3.client(
service_name="s3",
endpoint_url=f"https://{account_id}.r2.cloudflarestorage.com",
aws_access_key_id=os.environ["R2_ACCESS_KEY_ID"],
aws_secret_access_key=os.environ["R2_SECRET_ACCESS_KEY"],
region_name="auto",
config=Config(
signature_version="s3v4",
retries={"max_attempts": 3, "mode": "adaptive"},
),
)
def generate_presigned_download_url(bucket: str, object_key: str, expires_in: int = 900) -> str:
client = get_r2_client()
return client.generate_presigned_url(
ClientMethod="get_object",
Params={"Bucket": bucket, "Key": object_key},
ExpiresIn=expires_in,
)
if __name__ == "__main__":
r2 = get_r2_client()
r2.put_object(
Bucket="prod-release-artifacts",
Key="builds/v2.4.0/agent-linux-amd64.tar.gz",
Body=b"binary-release-payload",
ContentType="application/gzip",
)
signed_url = generate_presigned_download_url(
bucket="prod-release-artifacts",
object_key="builds/v2.4.0/agent-linux-amd64.tar.gz",
)
print(f"Presigned Zero-Egress R2 URL: {signed_url}")
Performance, Latency & Ecosystem Trade-Offs
While R2's pricing is compelling, production architecture decisions must account for latency and AWS ecosystem integration:
- Same-Region Compute Latency (EC2/EKS vs. R2): If your Spark, Trino, or PyTorch training clusters run inside AWS
us-east-1and read/write terabytes per hour to S3 via an AWS Gateway VPC Endpoint, S3 provides single-digit millisecond latency, multi-gigabit intra-AZ throughput, and $0.00/GB intra-region transfer. Routing high-frequency compute I/O from AWS EC2 over the public internet to Cloudflare R2 adds $10\text{–}40\text{ ms}$ of network round-trip latency per request. - S3 Feature Parity Gaps: Cloudflare R2 supports core object operations (
PUT,GET,Multipart Upload, presigned URLs, object lifecycle expiration rules, CORS, and event notifications via Cloudflare Queues), but lacks S3 Object Lock (WORM compliance mode), S3 Select, Glacier Deep Archive, and native AWS IAM Role (IRSA) binding without static access keys. - Zero-Downtime Migration with Sippy: Cloudflare R2 includes Sippy (incremental on-demand migration). When a client requests an object not yet in R2, R2 transparently fetches it from your AWS S3 bucket, serves the user, and caches a copy in R2—eliminating bulk migration egress spikes and downtime.
Architecture Decision Framework
- Choose Cloudflare R2 when: Outbound egress bandwidth exceeds storage volume (e.g., video/audio streaming, software binaries, AI/ML model weights, public user-generated media, multi-cloud datasets). You want to serve assets globally via Cloudflare CDN custom domains without paying origin-fetch egress fees.
- Choose AWS S3 when: Workloads run tightly coupled inside AWS VPCs (EMR, Athena, Redshift Spectrum, SageMaker) where same-region VPC Endpoint traffic is already free and ultra-low latency is critical. Regulatory compliance requires S3 Object Lock (SEC 17a-4 WORM), customer-managed KMS keys (
SSE-KMS), or multi-year Glacier Deep Archive storage at$0.00099/GB-month.
Common Mistakes
- Assuming AWS CloudFront eliminates all S3 origin-fetch costs: While AWS waives S3-to-CloudFront data transfer fees (
$0.00/GB), CloudFront still charges $0.085/GB for outbound internet egress to end users (beyond the 1 TB/month free tier)—whereas R2 paired with a custom Cloudflare domain charges $0.00/GB for both origin fetch and CDN delivery. - Ignoring small-object request amplification: Storing 500 million tiny $2\text{ KB}$ JSON files (
1 TBtotal) and overwriting them hourly generates $360\text{ billion}$ Class A writes/month—costing over $1.6M/month in API operations on either S3 or R2 despite costing only $15–$23 in raw storage. Always batch small records into Parquet or.tar.zstarchives. - Hardcoding region names other than
"auto"in Boto3: Passingregion_name="us-east-1"or"wnam"toboto3when signing requests for Cloudflare R2 triggersSignatureDoesNotMatcherrors; always configureregion_name="auto".
Summary
Cloudflare R2 breaks the cloud egress bottleneck by combining S3 API compatibility with $0.00/GB outbound bandwidth and $0.015/GB-month storage—cutting monthly bills by 80% to 99% for media delivery, artifact distribution, and multi-cloud data sharing. Meanwhile, AWS S3 remains the stronger choice for intra-VPC analytical data lakes, strict WORM compliance workloads, and sub-cent cold Glacier archives.