Skip to content

Cloudflare R2

Key idea:

Cloudflare R2 — S3-compatible object storage with zero egress fees (AWS S3 charges ~$0.09/GB outbound). Storage price: $0.015/GB/mo. Access: S3 API (aws-cli, rclone, boto3 work unchanged). Integrations: Workers for on-the-fly image transforms, Hyperdrive for DB caching. Used by: Shopify, Notion, Superhuman.

Below: details, example, related terms, FAQ.

Check your site →

Details

  • S3 API 100 % compatible: aws-cli, boto3, rclone, mc — no changes
  • Pricing: $0.015/GB storage, $0 egress, $4.50 per million Class A operations (PUT/POST/LIST)
  • Custom domain + HTTP/3: attach an R2 bucket to your own domain directly
  • Workers integration: fetch() an R2 object → transform → return — zero network hop
  • Multipart upload up to 5 TB/object, 11 9's regional durability

Example

# aws-cli config for R2
$ aws configure --profile r2
AWS Access Key ID: <R2_KEY>
AWS Secret: <R2_SECRET>
Default region: auto

# Upload
$ aws s3 cp file.zip s3://my-bucket/ \
    --endpoint-url https://<ACCOUNT>.r2.cloudflarestorage.com \
    --profile r2

Related

Understanding Cloudflare R2's Pricing Model

Cloudflare R2 offers a competitive pricing model that can significantly reduce storage costs for businesses that rely on cloud storage solutions. Unlike traditional providers like AWS S3, which impose egress fees of approximately $0.09 per GB for data transferred out, Cloudflare R2 eliminates these charges entirely. This unique feature makes it particularly appealing for applications with high data transfer needs.

The storage cost for R2 is set at a flat rate of $0.015 per GB per month. This pricing structure allows businesses to predict their monthly expenses more accurately, facilitating better budget management. Additionally, there are no hidden fees or complex tiered pricing structures, which can often complicate cost assessments with other providers.

To better illustrate the cost savings, consider a scenario where a company stores 10 TB of data and transfers 5 TB out monthly. With AWS S3, the storage cost alone would be $150 (10,000 GB x $0.015), but the egress fees would add an additional $450 (5,000 GB x $0.09), bringing the total to $600. In contrast, using Cloudflare R2, the total cost would remain at just $150 per month, resulting in a substantial savings of $450.

Integrating Cloudflare R2 with Existing Applications

Integrating Cloudflare R2 into your existing applications is straightforward, thanks to its S3-compatible API. This compatibility allows developers to use familiar tools and libraries without significant code changes. Below are practical examples of how to configure popular tools to work with R2.

  • Using AWS CLI: To configure the AWS CLI to interact with R2, run the following command:
aws configure --profile cloudflare-r2

Then, input your Cloudflare R2 access key, secret key, and set the default region to 'auto'.

  • Using Rclone: To set up Rclone, add a new remote:
rclone config

Follow the prompts to create a new remote, selecting 'S3' as the storage type and specifying Cloudflare R2’s endpoint URL. This allows you to manage files stored in R2 seamlessly.

  • Using Boto3: For Python applications, Boto3 can be configured as follows:
import boto3

session = boto3.Session(
    aws_access_key_id='YOUR_ACCESS_KEY',
    aws_secret_access_key='YOUR_SECRET_KEY',
    region_name='auto'
)
s3 = session.resource('s3', endpoint_url='https://.r2.cloudflarestorage.com')

With these configurations, developers can leverage Cloudflare R2's capabilities without needing to overhaul their existing systems.

Key Features of Cloudflare R2

Cloudflare R2 is designed with several key features that enhance its utility as an S3-compatible storage solution. Understanding these features can help organizations leverage R2 effectively to meet their storage and data management needs.

  • Zero Egress Fees: As mentioned, R2 does not charge for data egress, making it an economical choice for businesses with high outbound data transfer.
  • High Availability: Built on Cloudflare's global network, R2 ensures high availability and redundancy, allowing users to access their data from various geographical locations without latency issues.
  • Integrated Security Features: R2 includes robust security measures, such as encryption at rest and in transit, ensuring that sensitive data remains secure throughout its lifecycle.
  • Seamless Integration with Cloudflare Products: R2 can be easily integrated with other Cloudflare services, such as Workers for real-time image processing and Hyperdrive for database caching, enhancing its functionality.

These features collectively position Cloudflare R2 as a compelling alternative to traditional cloud storage solutions, particularly for businesses looking to optimize costs while maintaining high performance and security standards.

Learn more

Frequently Asked Questions

When is R2 cheaper than S3?

When egress > 10 % of storage cost (image hosting, video, static sites). For rarely-read archival — S3 Glacier is cheaper.

Minimum retention?

None. Unlike S3 Glacier, deletion is free and instant.

Do I need Workers?

No, R2 works standalone via S3 API. Workers are a bonus for transforms/caching.

Try the live tool that powered this guide

Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.