🎉 DevOps Interview Prep Bundle is live — 1000+ Q&A across 20 topicsGet it →
All Articles

Cloudflare R2 vs AWS S3 vs Backblaze B2: Object Storage in 2026

A detailed comparison of Cloudflare R2, AWS S3, and Backblaze B2 for object storage in 2026 — pricing, egress fees, S3 compatibility, performance, and which one wins for each use case.

DevOpsBoys5 min read
Share:Tweet

Your S3 bill has a line item called "Data Transfer OUT" that makes no sense for backups you almost never retrieve. Cloudflare R2 and Backblaze B2 exist precisely because of that. Here is a complete comparison to help you pick the right object storage for each workload.

Pricing Breakdown (2026)

AWS S3Cloudflare R2Backblaze B2
Storage (per GB/month)$0.023$0.015$0.006
Egress to internet$0.09/GB (first 10TB)$0.00$0.01/GB (first 1GB free daily)
Class A ops (PUT, POST)$0.005/1k$0.0036/1k$0.004/1k
Class B ops (GET)$0.0004/1k$0.00036/1k$0.004/1k
Free tier5GB storage, 20k GET10GB storage, 10M Class A, 10M Class B10GB storage

The headline difference: R2 has zero egress fees. For media-heavy workloads, that single change can cut your storage bill by 60–80%.

S3 API Compatibility

All three support the S3 API — but the compatibility level varies.

AWS S3: The reference implementation. Every SDK, every tool, every tutorial assumes S3 by default.

Cloudflare R2: S3-compatible. Works with the AWS SDK by pointing the endpoint at your R2 endpoint:

python
import boto3
 
s3 = boto3.client(
    "s3",
    endpoint_url="https://<account-id>.r2.cloudflarestorage.com",
    aws_access_key_id="<R2_ACCESS_KEY>",
    aws_secret_access_key="<R2_SECRET_KEY>",
    region_name="auto",
)
 
s3.upload_file("backup.tar.gz", "my-bucket", "backup.tar.gz")

R2 does not support S3 Object Lock, S3 Intelligent-Tiering, S3 Replication, or multi-part upload listing in exactly the S3 way. For most workloads, these are not blockers.

Backblaze B2: Also S3-compatible via their S3-compatible API endpoint (s3.us-west-004.backblazeb2.com). The native B2 API is different but you can ignore it and use the S3 API:

bash
aws s3 ls s3://my-b2-bucket \
  --endpoint-url https://s3.us-west-004.backblazeb2.com \
  --region us-west-004

Durability and Availability

All three offer 11 nines (99.999999999%) durability — this is the industry standard achieved by replicating data across multiple physical locations.

Availability SLAs:

  • S3 Standard: 99.99% availability
  • R2: 99.9% availability (as of 2026)
  • B2: 99.9% availability

For most workloads, 99.9% vs 99.99% does not matter. If you are building a primary database or high-frequency trading system on object storage, stick with S3.

Performance

Latency: S3 wins, especially for applications co-located in AWS. R2 benefits from Cloudflare's global edge network — reads via a public Cloudflare URL are served from the nearest PoP, which is fast. B2 has fewer datacenters (US West, US East, EU Central, AP Tokyo as of 2026).

Throughput: All three support parallel multipart uploads and can sustain very high throughput for large file transfers.

For CI/CD pipeline artifact caching (the most common DevOps use case), all three are fast enough. The latency difference is measured in tens of milliseconds, not seconds.

Use Cases and Who Wins Each

Terraform State Storage

Winner: AWS S3

Terraform's S3 backend has native DynamoDB locking, versioning, and encryption support. Migrating state to R2 or B2 requires more manual work and lacks the locking mechanism natively.

hcl
terraform {
  backend "s3" {
    bucket         = "my-tf-state"
    key            = "prod/terraform.tfstate"
    region         = "ap-south-1"
    dynamodb_table = "terraform-state-lock"
    encrypt        = true
  }
}

There is an S3-compatible backend workaround for R2, but it requires configuring skip_credentials_validation and skip_metadata_api_check flags — fine for teams comfortable with the tradeoff.

Static Website / CDN Origin

Winner: Cloudflare R2

R2 integrates directly with Cloudflare Pages and Workers. Zero egress means you never pay for CDN traffic. Enable public access on a bucket, point your Cloudflare zone at it, done:

bash
# Enable R2 public access via Wrangler
wrangler r2 bucket create my-assets
# Configure custom domain in Cloudflare dashboard → R2 → Bucket → Settings → Custom Domains

Backup and Archive

Winner: Backblaze B2

At $0.006/GB for storage, B2 is the cheapest option for cold backups you rarely access. Egress is $0.01/GB but you only pay when restoring, which is infrequent.

bash
# Restic backup to B2
restic -r b2:my-backup-bucket:/hostname init
restic -r b2:my-backup-bucket:/hostname backup /data
 
# Or via rclone
rclone sync /data b2:my-backup-bucket --progress

B2 also has a partnership with Cloudflare: egress from B2 to Cloudflare is free (Bandwidth Alliance). So you can store in B2 and serve via Cloudflare CDN with zero egress cost.

Media Storage (User Uploads, Video, Images)

Winner: Cloudflare R2

If users upload and download files directly, egress from S3 will destroy your budget. R2's zero egress plus Cloudflare's image transformation (resize on the fly) makes it the clear winner.

CI/CD Artifact Cache

Winner: AWS S3 (if on AWS) / R2 (otherwise)

GitHub Actions native S3 caching and most CI platforms have first-class S3 support. If your infra is already in AWS, keep artifacts in S3 to avoid cross-cloud egress. If you are building cloud-agnostic pipelines, R2 is the better alternative.

Migration from S3 to R2

Use rclone for one-time migration:

bash
# Configure both remotes
rclone config  # add s3 remote and r2 remote
 
# Sync S3 → R2
rclone sync s3:my-old-bucket r2:my-new-bucket \
  --transfers 20 \
  --checkers 20 \
  --progress
 
# Verify
rclone check s3:my-old-bucket r2:my-new-bucket

Egress from S3 to the internet during migration is billed at S3 rates (~$0.09/GB). For a 1TB migration, that is ~$90 in one-time egress. Calculate this cost before deciding to migrate.

Decision Table

Use caseBest choice
Terraform remote stateAWS S3
CDN origin / zero egressCloudflare R2
Cold backup / archiveBackblaze B2
Media storage + transformsCloudflare R2
Multi-region replicationAWS S3
Budget-first, AWS workloadBackblaze B2 (via B2+Cloudflare)
AWS-native appAWS S3

Final Verdict

For new projects with no AWS dependency, start with R2. Zero egress alone justifies it for any public-facing workload. For cold backups, B2 is the cheapest. S3 remains the safest choice when you need ecosystem maturity, AWS-native integrations, and compliance certifications.


Get started: Cloudflare R2 free tier, Backblaze B2 10GB free, AWS S3 console.

🔧

Today I Fixed

Short real fixes from production — posted daily

Browse fixes
Newsletter

Stay ahead of the curve

Get the latest DevOps, Kubernetes, AWS, and AI/ML guides delivered straight to your inbox. No spam — just practical engineering content.

Related Articles

Comments