Search

Search pages, services, tech stack, and blog posts

Cloudflare R2

Cloudflare R2 DatabaseS3-compatible object storage with zero egress fees

Cloudflare R2 is an S3-compatible object storage service with no egress charges — making it dramatically cheaper than AWS S3 for high-bandwidth workloads. We use R2 for media storage, backups, and large-scale asset delivery.

Cloudflare R2 is an S3-compatible object storage service with a game-changing pricing model — zero egress fees. Every byte of data transferred out of R2 is free, making it dramatically cheaper than AWS S3 for high-bandwidth workloads like media delivery, CDN origins, and large file distribution. R2 uses the same S3 API, so existing AWS SDKs (aws-sdk, boto3) work with a simple endpoint override. It integrates natively with Cloudflare Workers via bindings (no HTTP overhead), supports presigned URLs for secure uploads, and serves assets through Cloudflare's CDN at 300+ edge locations.

Quick start

bash
# Create an R2 bucket via Wrangler
npx wrangler r2 bucket create my-bucket

# Upload a file
npx wrangler r2 object put my-bucket/file.txt --file=./file.txt

# Or use the S3-compatible API
npm install @aws-sdk/client-s3
# Configure with R2 endpoint and credentials

Read the full documentation at developers.cloudflare.com/r2/

Zero egress fees

Data transfer out of R2 is free — no surprise bandwidth bills when your content gets popular.

S3-compatible API

Drop-in replacement for AWS S3 — existing SDKs (aws-sdk, boto3) work with R2 via endpoint override.

Presigned URLs

Time-limited presigned URLs for secure direct uploads and downloads — clients never see your credentials.

R2 + Workers binding

Access R2 directly from Cloudflare Workers via native bindings — no HTTP round-trip, no auth headers.

Custom domain delivery

Serve R2 assets from your own domain via Cloudflare's CDN — cached at 300+ edge locations worldwide.

Lifecycle rules

Automatic object expiry and class transitions — clean up temp uploads and archive old data on a schedule.

Why it's hard

Feature parity with S3

R2 doesn't support all S3 features — no object lock, limited event notifications, and no storage class tiering. Evaluate whether R2's feature set covers your specific requirements.

Multi-region write strategy

R2 stores data in a single region by default with global read distribution. Applications needing multi-region writes may need a more complex architecture.

Migration from S3

Migrating large datasets from S3 to R2 requires careful planning — tools like rclone can sync buckets, but timing the DNS cutover to avoid downtime requires coordination.

Best practices

Use Workers bindings for zero-latency access

Access R2 directly from Cloudflare Workers via native bindings — no HTTP round-trip, no auth headers, no SDK initialization.

Serve assets through a custom domain

Configure a custom domain on R2 to serve files through Cloudflare's CDN — cached at 300+ edge locations with your own domain name.

Use presigned URLs for browser uploads

Generate presigned URLs server-side and let clients upload directly to R2 — same pattern as S3, but with zero egress cost on downloads.

Frequently asked questions



Want to build with Cloudflare R2?

Talk to our engineering team about your Cloudflare R2 architecture. We'll respond within 24 hours.

1 spot available in May 2026Apr 2026 fully booked

We limit intake each month so every project gets the focus it deserves.