AWS S3 → Cloudflare R2
easyR2 has zero egress fees vs S3's $0.09/GB. R2 is S3-compatible — just change the endpoint. Ideal for assets served to users.
Cloudflare Dashboard → R2 → Create Bucket. Note the account ID.
R2 → Manage API Tokens → Create API Token with R2 permissions.
R2 is S3-compatible. Change endpoint, keep the same AWS SDK.
const r2 = new S3Client({
region: 'auto',
endpoint: `https://${ACCOUNT_ID}.r2.cloudflarestorage.com`,
credentials: { accessKeyId: R2_ACCESS_KEY, secretAccessKey: R2_SECRET_KEY }
})Use rclone to copy objects from S3 to R2.
rclone copy s3:my-bucket r2:my-bucket --transfers 32
Enable public R2 domain or custom domain. Update any hardcoded S3 URLs.
What this migration involves
Moving from AWS S3 to Cloudflare R2 is rated easy and takes about 1-3h on a typical project. The guide breaks it into 5 steps, 2 of which ship with runnable commands and 1 with a verification check. On pricing, AWS S3 is paid and Cloudflare R2 is freemium with a free plan to test the move.
FAQ
How long does migrating from AWS S3 to Cloudflare R2 take?
Around 1-3h for a typical project — 5 steps, difficulty rated easy, 2 of them with copy-paste commands.
Is moving from AWS S3 to Cloudflare R2 reversible?
No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your AWS S3 data before you start.
What does Cloudflare R2 cost compared to AWS S3?
AWS S3: paid from $0/mo. Cloudflare R2: freemium from $0/mo, free plan available.