Cloudflare R2 is S3-compatible object storage with zero egress fees. Store and serve files globally without paying for bandwidth — a game-changer for media-heavy applications.
Why R2 Saves Thousands on Storage
A video platform was paying $3,000/month in AWS S3 egress fees. Same storage on R2: $0 egress. They saved $36,000/year by switching one line in their S3 SDK config.
Key Features:
- Zero Egress Fees — No bandwidth charges ever
- S3 Compatible — Use existing S3 SDKs and tools
- Global Distribution — Automatic edge caching
- Free Tier — 10GB storage, 10M reads/month, 1M writes/month
- Workers Integration — Access from Cloudflare Workers
Quick Start (S3 SDK)
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3"
const s3 = new S3Client({
region: "auto",
endpoint: "https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com",
credentials: {
accessKeyId: "YOUR_ACCESS_KEY",
secretAccessKey: "YOUR_SECRET_KEY"
}
})
await s3.send(new PutObjectCommand({
Bucket: "my-bucket",
Key: "image.png",
Body: fileBuffer
}))
From Workers
export default {
async fetch(request, env) {
const object = await env.MY_BUCKET.get("image.png")
return new Response(object.body, {
headers: { "Content-Type": "image/png" }
})
}
}
Why Choose R2
- Zero egress — never pay for bandwidth
- S3 compatible — migrate in minutes
- Generous free tier — 10GB free
Check out R2 docs to get started.
Need storage solutions? Check out my Apify actors or email spinov001@gmail.com for custom solutions.
Top comments (0)