Skip to main content
← Guides

API guide

AWS S3 vs Cloudflare R2: Object Storage Compared 2026

Updated APIScout Team12 min read

Compare S3 and R2 on download costs, request fees, object limits, archive tiers, and S3 API compatibility.

Contents

TL;DR

Choose Cloudflare R2 Standard for public downloads when direct internet transfer drives your storage bill. R2 charges for storage and requests, with no R2 egress fee. Choose Amazon S3 when you need Glacier archives, S3 Object Lock, or native AWS event targets. Compare CloudFront separately if it serves your traffic. Before migrating, check the S3 operations and headers your application actually sends.

Key Takeaways

  • Price the delivery path. R2's zero-egress rate applies to direct R2 delivery. S3-to-CloudFront origin transfer and S3 transfer to AWS services in the same Region are free. CloudFront has its own viewer delivery plans.
  • Check your largest object. AWS advertises a 50 TB ceiling for S3 and lists a 48.8 TiB multipart limit. R2 lists an effective maximum object size of 4.995 TiB. Repartition larger objects before copying them to R2.
  • Test the API surface you use. R2 accepts common S3 object calls, including multipart uploads. S3 bucket versioning and Object Lock calls are outside that compatible surface.

Feature Comparison

At-a-glance decisionCloudflare R2Amazon S3
Public downloads and static assetsStart with Standard. Direct R2 egress is free. Count origin GetObject calls as Class B and use a custom domain if you want Cloudflare caching.Model S3 Standard in your bucket's Region. In N. Virginia, direct internet transfer starts at $0.09 per AWS-billed GB after the shared allowance. Add GET fees. For CloudFront, model viewer delivery separately.
Infrequently read dataInfrequent Access lowers the storage rate. Count Class A and B requests, retrieval bytes, and the minimum storage duration. Direct R2 egress stays free.Compare regional Standard-IA and One Zone-IA rates. Count requests, retrieval bytes, minimum storage duration, and any direct internet transfer. One Zone-IA keeps data in a single Availability Zone.
Long-term backup and restoreStandard and Infrequent Access both keep objects online. Budget storage, calls, and Infrequent Access retrieval if you use that class.Glacier Flexible Retrieval and Deep Archive can lower storage cost in your Region. Budget RestoreObject, retrieval, temporary Standard storage, GETs, and any outbound transfer. Set a restore deadline before choosing a class.
Large multipart objectsThe object ceiling is 4.995 TiB. Split larger files. Budget Class A calls to start and finish uploads, upload or copy parts, and list uploads or parts. Aborts are free.AWS advertises up to 50 TB across AWS Regions. Its multipart guide lists 48.8 TiB. Count multipart requests and check your client's limits before migrating.
Versioned retention and event processingBucket locks apply by prefix. R2 event notifications publish to Cloudflare Queues. Budget R2 operations and any Queue or Worker usage.S3 Object Lock applies to versions in versioned buckets. Notifications can target Lambda, SNS, SQS, or EventBridge. Model requests and any downstream or cross-Region charges separately.

API fit

CapabilityCloudflare R2Amazon S3 general purpose buckets
Bucket versioningS3 versioning operations are unsupportedAvailable when enabled
RetentionR2 bucket locks with rules an authorized operator can removeS3 Object Lock governance and compliance modes, plus legal holds
Lifecycle and replicationTransition to Infrequent Access by age or expire objects. The S3 replication configuration API is unsupported.Lifecycle transitions span multiple classes. Configurable same-Region and cross-Region replication.
Presigned URLsSign for the R2 S3 API hostname. Custom domains are a separate public serving path.Presigned object URLs follow bucket permissions and signer credentials.
Query and batch APIsThe R2 compatibility matrix excludes S3 Select. Inventory the individual operations when porting S3 Batch Operations jobs.S3 Select is limited to existing customers. S3 Batch Operations is available for supported tasks.

Pricing Breakdown

Cloudflare R2 Pricing

MeterStandardInfrequent Access
Storage$0.015 per GB-month$0.01 per GB-month
Class A, including PUT and LIST$4.50 per million$9.00 per million
Class B, including GET and HEAD$0.36 per million$0.90 per million
Data retrievalNo fee$0.01 per GB retrieved
Direct R2 internet egress$0$0
Monthly R2 free usage10 GB-month, 1 million Class A, 10 million Class BNo allowance

For multipart uploads, count CreateMultipartUpload, UploadPart, UploadPartCopy, CompleteMultipartUpload, ListMultipartUploads, and ListParts as Class A. AbortMultipartUpload is free. R2 operation pricing

Cloudflare rounds billable usage up to whole units. A batch that goes just over a million billable operations costs the rate for two million. Infrequent Access has a 30-day minimum storage duration. Direct R2 transfer through the S3 API, Workers binding, or r2.dev has no egress charge. Workers and other metered services can have their own charges. Use a custom domain for production public assets if you want Cloudflare caching. R2 pricing · Public buckets

AWS S3 Pricing (US East - N. Virginia)

MeterS3 StandardS3 Standard-IA
Storage$0.023 per GB-month in the first 50 TB tier$0.0125 per GB-month
PUT, COPY, POST, LIST$5 per million$10 per million
GET$0.40 per million$1 per million
Data retrievalNo fee$0.01 per GB retrieved

AWS bills storage in binary units and labels them GB and TB. For direct internet transfer from N. Virginia, the first 10 TB of paid usage costs $0.09 per AWS GB and the next 40 TB costs $0.085 per AWS GB. AWS includes 100 GB a month of internet transfer across eligible services and Regions, excluding China and GovCloud. The allowance is shared with the rest of your AWS usage. AWS Free Tier account credits are a separate program.

S3-to-CloudFront origin transfer is free. Price the viewer path under your CloudFront plan and count S3 requests on origin fetches. For internal applications, S3 data transfer to AWS services in the bucket's Region is also free. S3 pricing · AWS transfer price list · CloudFront pricing

Real-World Cost Scenarios

Use these estimates to see which meter drives the bill. Each row assumes the listed monthly storage and internet transfer quantities on each provider's billing meter. Convert your byte totals to each provider's units before applying the rates to your own workload. The rows use R2 Standard and S3 Standard in N. Virginia, the full R2 Standard allowances, and the full AWS shared 100 GB egress allowance. They exclude taxes, discounts, account credits, CDN and compute fees, and calls other than the listed PUTs and GETs.

Monthly storage, in vendor GB-monthDirect internet transfer, in vendor GBMonthly PUTs / GETsR2 StandardS3 Standard (N. Virginia)
100500100,000 / 1 million$1.35$39.20
1,0005,0001 million / 10 million$14.85$473.00
1,00050,0002 million / 50 million$33.75$4,345.70

In the middle row, R2 bills for 990 GB-month and both request counts fit in the allowance. S3 bills $23 for storage, $9 for calls, and $441 for 4,900 GB of internet transfer. The last row crosses into the next paid S3 transfer tier. If CloudFront or a Cloudflare custom domain serves cached traffic, recalculate calls that reach the origin before using this table.

Where S3 Wins on Storage Cost

ClassStorage price in N. VirginiaRestore or accessMinimum billed duration
S3 Standard-IA$0.0125 per GB-monthImmediate GET, with retrieval charges30 days
S3 One Zone-IA$0.01 per GB-monthImmediate GET, with retrieval charges30 days
S3 Glacier Flexible Retrieval$0.0036 per GB-monthRestore first. Standard restores typically take 3–5 hours.90 days
S3 Glacier Deep Archive$0.00099 per GB-monthRestore first. Standard restores typically complete within 12 hours and bulk within 48 hours.180 days

Compare full restore costs before using a storage-only rate to size a backup budget. Glacier Flexible Retrieval and Deep Archive can incur request, retrieval, and temporary S3 Standard storage charges. S3 also adds billable metadata for archived objects. Small objects can change the economics. N. Virginia Deep Archive rates · S3 class details · S3 restore options

Storage Classes

S3 Standard suits frequently accessed objects. Intelligent-Tiering tracks access patterns and moves eligible objects automatically, with a per-object monitoring charge and no retrieval fees. S3 Standard-IA and One Zone-IA keep infrequent data online. One Zone-IA trades multi-zone placement for a lower storage rate. Glacier Instant Retrieval also supports immediate GET. Use Flexible Retrieval or Deep Archive when your recovery plan can wait for a restore. S3 Lifecycle can transition eligible objects between classes. Check the minimum eligible object size and early-deletion charges before applying a rule to an existing bucket.

R2 Standard suits active objects. R2 Infrequent Access is useful when storage savings cover retrieval and higher request rates. R2 lifecycle rules can transition objects to Infrequent Access or expire them. When estimating savings for short-lived objects, include the 30-day Infrequent Access minimum.

S3 API Compatibility

The same AWS SDK can issue PutObject and GetObject against both services. With S3, use the bucket Region and the normal SDK credential chain. With R2, use the account's S3-compatible endpoint, signing Region auto, and R2 credentials scoped to the bucket. Review the supported headers and bucket calls before porting code that relies on AWS-managed KMS keys, ACLs, Object Lock, bucket versioning, or replication configuration. Check your account's endpoint if you use an R2 jurisdiction-specific bucket. R2 S3 compatibility · R2 SDK configuration · R2 credentials

The JavaScript SDK defaults to CRC32 for uploads. R2 lists CRC32 support for composite checksums only. For this single-part upload, the R2 client uses WHEN_REQUIRED to omit the optional upload checksum. It also omits the optional download checksum request. The S3 client keeps the SDK defaults. If you need an explicit checksum on R2, check the algorithm, checksum type, and operation headers in the compatibility matrix. AWS SDK upload checksums · AWS SDK checksum settings

The following Node.js example was tested against a mock with no network access. It round-trips a small text object. For a real run, supply a test bucket and the provider's credentials through the environment.

import { GetObjectCommand, PutObjectCommand, S3Client } from '@aws-sdk/client-s3';

export function makeClient(provider) {
  if (provider === 's3') {
    return new S3Client({ region: process.env.AWS_REGION ?? 'us-east-1' });
  }

  const { R2_ENDPOINT, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY } = process.env;
  if (!R2_ENDPOINT || !R2_ACCESS_KEY_ID || !R2_SECRET_ACCESS_KEY) {
    throw new Error('Set the R2 endpoint and credentials for your test bucket');
  }
  return new S3Client({
    region: 'auto',
    endpoint: R2_ENDPOINT,
    requestChecksumCalculation: 'WHEN_REQUIRED',
    responseChecksumValidation: 'WHEN_REQUIRED',
    credentials: {
      accessKeyId: R2_ACCESS_KEY_ID,
      secretAccessKey: R2_SECRET_ACCESS_KEY,
    },
  });
}

export async function roundTrip(client, bucket, key) {
  const object = { Bucket: bucket, Key: key };
  await client.send(new PutObjectCommand({
    ...object,
    Body: 'storage check',
    ContentType: 'text/plain',
  }));
  const { Body } = await client.send(new GetObjectCommand(object));
  return Body.transformToString();
}

Workers can read a bound R2 bucket without embedding S3 credentials in the Worker. Expose only objects intended for the caller. Use a private route with authorization for user files. R2 Workers API

The following Worker example was tested against a mock R2 binding in the local Workers runtime. It serves public assets by decoding the URL path before looking up the object key. Malformed escapes return HTTP 400.

export default {
  async fetch(request, env) {
    let key;
    try {
      const path = new URL(request.url).pathname.slice(1);
      key = decodeURIComponent(path);
    } catch {
      return new Response('Bad Request', { status: 400 });
    }
    if (!key) return new Response('Not Found', { status: 404 });

    const object = await env.MY_BUCKET.get(key);
    if (!object) return new Response('Not Found', { status: 404 });

    const headers = new Headers();
    object.writeHttpMetadata(headers);
    return new Response(object.body, { headers });
  },
};

Migration: S3 to R2

  1. Inventory the bucket's largest objects, versions, retention settings, and the SDK operations and headers used by your application.
  2. Create a destination R2 bucket. Use Super Slurper to copy a representative prefix from S3. Choose how destination key conflicts should be handled. Estimate source GET and transfer charges for the copy separately from ongoing R2 charges.
  3. Point a test application at the R2 endpoint. Check uploads, downloads, presigned URLs, metadata, and error handling.
  4. Reconcile changes made during the copy before cutover. Compare object counts and sampled checksums, then switch readers and writers when the destination is ready. Keep the S3 source available until those checks pass.

Enterprise Features

Object Lock (WORM Compliance)

S3 Object Lock protects individual versions from deletion or replacement during retention. In compliance mode, even the account root user cannot shorten retention or delete a protected version during that period. Governance mode permits an authorized bypass. S3 also supports legal holds. R2 bucket locks prevent overwrites and deletes by bucket or prefix while the rule is active. Authorized operators can remove those rules through Cloudflare. A migration that depends on S3 Object Lock requires a separate retention design. S3 Object Lock · R2 bucket locks

Compliance Certifications

AWS lists S3 in scope for PCI DSS and FedRAMP, and as HIPAA-eligible under an AWS business associate agreement. FedRAMP scope depends on the environment, with Class C in AWS US East/West and Class D in AWS GovCloud (US). For R2, start with Cloudflare's data security documentation and confirm the exact product, jurisdiction, and agreement with Cloudflare. Review scope and workload controls with your compliance team before moving regulated data. S3 compliance · AWS FedRAMP · R2 data security

Event-Driven Architecture

S3 can notify Lambda, SNS, SQS, or EventBridge. For a Lambda that writes back to its source bucket, limit notifications to an input prefix so processed objects do not trigger the function again. R2 notifications deliver object events to a Cloudflare Queue, with a Worker consumer or HTTP pull. Plan to change the delivery configuration and event parsing during a migration. S3 event notifications · R2 event notifications

The following Node.js Lambda example was tested against a mock S3 client. Configure an object-created trigger for the incoming/ prefix and grant the role read access to that prefix and write access to processed/. This example processes small text objects in memory.

import { GetObjectCommand, PutObjectCommand, S3Client } from '@aws-sdk/client-s3';

export const s3 = new S3Client({});

export async function handler(event) {
  for (const { s3: { bucket, object } } of event.Records) {
    const key = decodeURIComponent(object.key.replace(/\+/g, ' '));
    if (!key.startsWith('incoming/')) continue;

    const { Body } = await s3.send(new GetObjectCommand({
      Bucket: bucket.name,
      Key: key,
    }));
    const text = await Body.transformToString();
    await s3.send(new PutObjectCommand({
      Bucket: bucket.name,
      Key: key.replace(/^incoming\//, 'processed/'),
      Body: text.toUpperCase(),
      ContentType: 'text/plain',
    }));
  }
}

Access Control

S3 supports IAM policies, bucket policies, Access Points, and VPC endpoints for private access. R2 uses scoped API tokens for its S3 endpoint and bindings inside Workers. Both provide encryption at rest and TLS in transit. If your S3 application depends on AWS KMS policy, private AWS network endpoints, or cross-account IAM, map those dependencies before moving its objects. S3 access management · S3 security · R2 data security

When to Choose Cloudflare R2

Choose R2 Standard for media, public downloads, and static assets when direct outbound bytes are a large part of your bill. Count the Class A and Class B calls that reach the bucket. Add Workers or Queues charges if you use them. For assets behind a custom domain, use actual cache misses to estimate origin reads. Consider Infrequent Access for older objects when their retention and retrieval pattern makes it cheaper.

When to Choose AWS S3

Choose S3 for Glacier restores, version-level Object Lock, files beyond R2's object limit, and workflows built around AWS IAM and native event targets. A same-Region AWS application already has free transfer from S3, so compare storage, requests, and retrieval before moving it. If users download through CloudFront, compare the CDN plan and origin requests with your R2 delivery path.

You can also keep archives and AWS processing on S3 while serving public assets from R2. Count duplicate storage and the cost of copying between providers.

Methodology

The decision table uses published AWS and Cloudflare rates, limits, and compatibility documentation. AWS prices in the examples are on-demand rates for US East (N. Virginia). The estimate uses monthly meter quantities and the named calls. Use your Region, request mix, storage class, and internet or CDN path for a production quote. The Node.js and Workers examples show what the local mocks exercised. Check policies, retention, and service behavior in your own test buckets before cutover.

Sources

Choosing your cloud storage stack? Compare AWS S3, Cloudflare R2, and more on APIScout.

Compare Cloudflare R2 and AWS S3 on APIScout.