Cloudflare R2 vs S3: Object Storage for VPS Hosts

Published: (April 29, 2026 at 03:11 AM EDT)
4 min read
Source: Dev.to

Source: Dev.to

Object‑storage use cases for VPS hosts

  • Static assets and media uploads
  • Backups / snapshots (app‑level, not hypervisor‑level)
  • Log archives and data exports
  • CDN origins for websites

When you host on providers like DigitalOcean or Hetzner, you’re typically trying to keep costs predictable while still getting global performance. Object storage is the easiest place to accidentally blow that up.

Cost comparison

S3 economics

  • Storage: competitively priced.
  • Egress: the biggest line item; you pay per GB transferred out.
  • Requests & features: lifecycle transitions, replication, event notifications, etc., add extra charges.
  • CDN: putting S3 behind CloudFront can improve delivery, but you remain in AWS billing land.

R2 economics

  • Storage: billed per GB stored.
  • Operations: billed per request (PUT, GET, LIST, etc.).
  • Egress: $0 egress from R2; data transferred to the public internet is handled inside Cloudflare’s edge network.
  • Caveat: “no egress” does not eliminate all network costs—your VPS provider may still charge for outbound (or inbound) bandwidth.

Performance & architectural impact

  • S3 is region‑centric. Requests travel to the chosen region unless you add a CDN layer.
  • R2 lives close to Cloudflare’s edge and works especially well with Cloudflare caching, giving low‑latency reads worldwide without extra setup.

Typical scenarios

ScenarioBest fit
App servers and users mostly in one AWS region (e.g., us‑east‑1)S3
Global visitors, already using Cloudflare for DNS/WAF/CDNR2
Internal workloads (backups, data pipelines) with no public readsS3 (regional model is fine)

Choosing between S3 and R2

When to pick S3When to pick R2
You need the full S3 feature set (event notifications, object lock, multiple storage classes, strict compliance)You expect high public download/streaming volume
Your compute runs in AWS and data locality mattersYou want predictable costs and a CDN‑friendly architecture
Heavy internal workflows that don’t benefit from edge deliveryYou’re already using Cloudflare for DNS, WAF, or CDN

Practical checklist for VPS hosting

  1. API compatibility – R2 implements the S3 API, but not every obscure feature. Test your tools against an R2 endpoint first.
  2. Tooling – Most backup utilities and SDKs that speak S3 will work with R2 by supplying a custom endpoint and access keys.
  3. Lock‑in considerations
    • S3: “lock‑in by gravity” – virtually every cloud service supports it.
    • R2: “lock‑in by workflow” – you become dependent on Cloudflare’s edge features if you lean heavily on them.

Rule of thumb: If you need advanced compliance controls or niche S3 capabilities, stick with S3. If you just need object storage that won’t punish you for serving files, R2 is often the better default.

Minimal AWS‑CLI‑style setup for R2

# 1) Configure a named profile for R2
aws configure set aws_access_key_id "$R2_ACCESS_KEY" --profile r2
aws configure set aws_secret_access_key "$R2_SECRET_KEY" --profile r2
aws configure set region auto --profile r2

# 2) Upload a backup (R2 is S3‑compatible, so use the S3 commands)
aws s3 cp ./backup.tar.gz s3://my-bucket/backups/backup.tar.gz \
  --endpoint-url https://.r2.cloudflarestorage.com \
  --profile r2

# 3) (Optional) List objects
aws s3 ls s3://my-bucket/backups/ \
  --endpoint-url https://.r2.cloudflarestorage.com \
  --profile r2

This migration takes minutes—not days—provided your app doesn’t rely on S3‑only features.

Recommendations for typical VPS‑hosted sites

  • WordPress, Laravel, Node, Django apps that serve lots of public assets: R2 is a strong default because egress is the silent killer, and Cloudflare built R2 to eliminate that pain.
  • Choose S3 when you need the full feature set, strict compliance, or your compute already lives in AWS.
  • Choose R2 when you expect high public download volume, want predictable costs, and already use Cloudflare’s network.

A common VPS‑hosting pattern:

VPS on Hetzner or DigitalOcean → object storage on R2 for user uploads and backups → stateless app. If you later outgrow the VPS, the storage separation makes migration easier—without a hard commitment today.

Some links in this article are affiliate links. We may earn a commission at no extra cost to you if you make a purchase through them.

0 views
Back to Blog

Related posts

Read more »