DEV Community

Juan Diego Isaza A.
Juan Diego Isaza A.

Posted on

Cloudflare R2 vs S3: Cost, Latency, and Fit

If you’re running a VPS and paying object storage bills, cloudflare r2 vs s3 is the comparison that can quietly move your margins. Both speak “S3-compatible,” both store blobs, and both can back static sites, backups, and media pipelines—but the trade-offs are very different once you factor in egress, latency, and operational friction.

Pricing and the egress tax (the real differentiator)

Amazon S3’s storage pricing is only half the story; the other half is getting data out. In VPS-hosting workflows (serving images, downloads, video segments, game assets), egress can dwarf storage costs.

Cloudflare R2’s headline feature is simple: zero egress fees (when you serve through Cloudflare’s network). That changes architecture decisions: you can be less aggressive about caching layers or CDN hit ratios because a cache miss doesn’t automatically become a line item that hurts.

S3, on the other hand, is a pricing maze:

  • You pay for storage per GB-month.
  • You pay per request (PUT/GET/LIST, etc.).
  • You pay for data transfer out (often the killer), unless you’re carefully routing through specific AWS services or using discounted paths.

Opinionated take: if you’re a small-to-mid VPS operator or indie SaaS shipping lots of public assets, R2’s “no egress” model is easier to reason about and harder to accidentally blow up. S3 still wins when you need deep AWS-native integrations and are willing to optimize around AWS’s rules.

Performance and latency from a VPS

From a VPS perspective, “fast” depends on where your compute is and how your users reach storage.

R2 sits behind Cloudflare’s global edge. If your app already uses Cloudflare for DNS/CDN/WAF, R2 can feel closer to end users because requests can terminate at the edge and fetch from R2 without the same penalty you’d see pulling from a single region.

S3 performance is excellent within AWS and within-region, and you can choose regions for proximity. But if your compute lives outside AWS (common with VPS hosting), you’ll often pay with higher latency and potentially egress if you’re moving data across providers.

Practical VPS hosting example:

  • A media-heavy app on hetzner or linode serving global users.
  • With S3, you’ll likely add a CDN in front (fine, but more moving parts).
  • With R2, the “CDN + storage” story is more tightly coupled if you’re already in the Cloudflare ecosystem.

If your workload is private (backups, internal artifacts) and your VPS and storage are in the same region/provider, latency differences matter less than cost predictability.

S3 compatibility, APIs, and migration reality

Both ecosystems speak S3-like APIs, but “compatible” isn’t “identical.” Expect edge cases:

  • Some S3 features don’t exist or behave differently (certain ACL patterns, advanced lifecycle controls, niche headers).
  • Tooling that assumes AWS-specific behavior can break in subtle ways.

The good news: for common VPS-hosting needs (static assets, user uploads, backup archives), basic S3-compatible operations are usually all you need.

Here’s an actionable example using the AWS CLI against R2 (handy for migrations and scripting). You’ll create an R2 bucket and then sync a local directory:

# Configure a named profile for R2 (use your R2 access keys)
aws configure set aws_access_key_id "$R2_ACCESS_KEY_ID" --profile r2
aws configure set aws_secret_access_key "$R2_SECRET_ACCESS_KEY" --profile r2
aws configure set region auto --profile r2

# Create a bucket (R2 uses an account-specific endpoint)
aws --profile r2 --endpoint-url https://<ACCOUNT_ID>.r2.cloudflarestorage.com \
  s3 mb s3://my-vps-backups

# Sync local files to R2
aws --profile r2 --endpoint-url https://<ACCOUNT_ID>.r2.cloudflarestorage.com \
  s3 sync ./backups s3://my-vps-backups --storage-class STANDARD
Enter fullscreen mode Exit fullscreen mode

For S3, you’d remove the custom endpoint and use the normal AWS region endpoint.

Migration tip: run a checksum/ETag verification pass if your data is critical; don’t assume a “successful sync” equals “bit-perfect forever.”

When to pick R2 vs S3 for VPS hosting

This is where I land after seeing teams overpay or overcomplicate.

Choose Cloudflare R2 if:

  • You serve lots of public assets and egress costs matter.
  • You already use cloudflare for CDN/WAF/DNS and want fewer vendors.
  • You want cost predictability more than every advanced feature.

Choose Amazon S3 if:

  • You’re deeply on AWS (Lambda, CloudFront, IAM patterns, analytics, eventing).
  • You need mature lifecycle policies, replication patterns, and battle-tested enterprise controls.
  • You can optimize egress (or your egress is naturally low).

Neutral reality: S3 is the “default” for a reason—breadth, maturity, and integrations. R2 is compelling because it attacks the most painful part of object storage bills.

A pragmatic setup for a VPS stack (soft recommendation)

If your compute lives on a VPS provider like digitalocean or vultr, a simple, low-drama pattern is: keep compute close to your users (or at least your database), store bulky objects in R2 or S3, and put a CDN in front of anything public. For many teams, R2 + Cloudflare’s edge is an easy win when bandwidth is unpredictable; for others, S3 remains the safe choice when AWS is already your operating system.


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.

Top comments (0)