Cloudflare R2
Overview
High-performance storage for files and objects with zero egress charges.
Cloudflare R2 Storage allows developers to store large amounts of unstructured data without the costly egress bandwidth fees associated with typical cloud storage services.
You can use R2 for multiple scenarios, including but not limited to:
- Storage for cloud-native applications
- Cloud storage for web content
- Storage for podcast episodes
- Data lakes (analytics and big data)
- Cloud storage output for large batch processes, such as machine learning model artifacts or data sets
R2 Pricing
| Free | Paid - Rates | |
|---|---|---|
| Storage | 10 GB / month | $0.015 / GB-month |
| Class A Operations | 1 million requests / month | $4.50 / million requests |
| Class B Operations | 10 million requests / month | $0.36 / million requests |
Pros
- It has a generous free-tier
- Supports S3 API which is excellent for compatibility. Especially, S3 CLI commands.
Guides
Create R2 Bucket
- Redirect to Cloudflare and sign in
- From the left sidebar click on
R2 - Click on
Create bucketbutton - Enter a name for the bucket and then click
Create bucketbutton.
Generate R2 API Token
- Redirect to Cloudflare and sign in
- From the left sidebar click on
R2 - On the right side column, click on
Manage R2 API Tokenslink. - Click on
Create API tokenbutton to navigate to creation form. In the creation form- Enter your token name
- Set permission according to your needs. Most common needs is to set
Object Read & Writeto allow two-way communication. - Under Specify buckets, choose whether the API to access all buckets or specific ones. It is recommended to apply to specific buckets
- Click on
Create API Tokenbutton.
- In the API token creation summary, you will be displayed with:
- Token value
- Access Key ID
- Secret Access Key
- Use jurisdiction-specific endpoints for S3 clients
- Be noted that "Token value", "Access Key ID", and "Secret Access Key" values are shown only on this screen, make sure to copy them before navigating from it.
Set Your Bucket for Public Access
- Redirect to Cloudflare and sign in
- From the left sidebar click on
R2 - Click on your bucket name under
Buckets - In Bucket page, click on
Settingstab. - In Settings page, under Public access, you will find a section called
R2.dev subdomainthat hasAllow Accessbutton; click on it. - Copy
Public R2.dev Bucket URL