# Getting started URL: https://developers.cloudflare.com/r2/get-started/ import { Render } from "~/components" Cloudflare R2 Storage allows developers to store large amounts of unstructured data without the costly egress bandwidth fees associated with typical cloud storage services.
## 1. Install and authenticate Wrangler :::note Before you create your first bucket, you must purchase R2 from the Cloudflare dashboard. ::: 1. [Install Wrangler](/workers/wrangler/install-and-update/) within your project using npm and Node.js or Yarn.Permission group | Resource | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Workers R2 Storage Write
|
Account | Can create, delete, and list buckets, edit bucket configuration, and read, write, and list objects. | ||||||||||||
Workers R2 Storage Read
|
Account | Can list buckets and view bucket configuration, and read and list objects. | ||||||||||||
Workers R2 Storage Bucket Item Write
|
Bucket | Can read, write, and list objects in buckets. | ||||||||||||
Workers R2 Storage Bucket Item Read
|
Bucket | Can read and list objects in buckets. | ||||||||||||
Workers R2 Data Catalog Write
|
Account | Can read from and write to data catalogs. This permission allows access to the Iceberg REST catalog interface. | ||||||||||||
Workers R2 Data Catalog Read
|
Account | Can read from data catalogs. This permission allows read-only access to the Iceberg REST catalog interface. |
Event type | Description | Trigger actions |
---|---|---|
object-create
|
Triggered when new objects are created or existing objects are overwritten. |
|
object-delete
|
Triggered when an object is explicitly removed from the bucket. |
|
Property | Type | Description |
---|---|---|
account
|
String | The Cloudflare account ID that the event is associated with. |
action
|
String |
The type of action that triggered the event notification. Example
actions include: PutObject , CopyObject ,{" "}
CompleteMultipartUpload , DeleteObject .
|
bucket
|
String | The name of the bucket where the event occurred. |
object
|
Object | A nested object containing details about the object involved in the event. |
object.key
|
String | The key (or name) of the object within the bucket. |
object.size
|
Number | The size of the object in bytes. Note: not present for object-delete events. |
object.eTag
|
String | The entity tag (eTag) of the object. Note: not present for object-delete events. |
eventTime
|
String | The time when the action that triggered the event occurred. |
copySource
|
Object |
A nested object containing details about the source of a copied object.
Note: only present for events triggered by CopyObject .
|
copySource.bucket
|
String | The bucket that contained the source object. |
copySource.object
|
String | The name of the source object. |
Storage class | Minimum storage duration | Data retrieval fees (processing) | Egress fees (data transfer to Internet) |
---|---|---|---|
Standard | None | None | None |
Infrequent Access |
30 days | Yes | None |
Name | Description | When to use | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Super Slurper | Quickly migrate large amounts of data from other cloud providers to R2. |
|
||||||||||||
Sippy | Incremental data migration, populating your R2 bucket as objects are requested. |
|
Metric | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
Requests served by Sippy |
The percentage of overall requests served by R2 over a period of time.{" "}
A higher percentage indicates that fewer requests need to be made to the source bucket. |
||||||||
Data migrated by Sippy | The amount of data that has been copied from the source bucket to R2 over a period of time. Reported in bytes. |
Action | New behavior | ||||||||
---|---|---|---|---|---|---|---|---|---|
GetObject |
Calls to GetObject will first attempt to retrieve the object from your
R2 bucket. If the object is not present, the object will be served from
the source storage bucket and simultaneously uploaded to the requested
R2 bucket.
Additional considerations:
|
||||||||
HeadObject | Behaves similarly to GetObject, but only retrieves object metadata. Will not copy objects to the requested R2 bucket. | ||||||||
PutObject | No change to behavior. Calls to PutObject will add objects to the requested R2 bucket. | ||||||||
DeleteObject |
No change to behavior. Calls to DeleteObject will delete objects in the
requested R2 bucket.
Additional considerations:
|
Operation | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
CreateBucket | Creation of a new bucket. | ||||||||
DeleteBucket | Deletion of an existing bucket. | ||||||||
AddCustomDomain | Addition of a custom domain to a bucket. | ||||||||
RemoveCustomDomain | Removal of a custom domain from a bucket. | ||||||||
ChangeBucketVisibility |
Change to the managed public access (r2.dev ) settings of a bucket.
|
||||||||
PutBucketStorageClass | Change to the default storage class of a bucket. | ||||||||
PutBucketLifecycleConfiguration | Change to the object lifecycle configuration of a bucket. | ||||||||
DeleteBucketLifecycleConfiguration | Deletion of the object lifecycle configuration for a bucket. | ||||||||
PutBucketCors | Change to the CORS configuration for a bucket. | ||||||||
DeleteBucketCors | Deletion of the CORS configuration for a bucket. |
ReadableStream
, if the key exists, and `null` if the key does not exist.
- In the event that a precondition specified in options
fails, get()
returns an R2Object
with body
undefined.
- `put` value
and metadata under the associated key
. Once the write succeeds, returns an `R2Object` containing metadata about the stored Object.
- In the event that a precondition specified in options
fails, put()
returns `null`, and the object will not be stored.
- R2 writes are strongly consistent. Once the Promise resolves, all subsequent read operations will see this key value pair globally.
- `delete` values
and metadata under the associated keys
. Once the delete succeeds, returns void
.
- R2 deletes are strongly consistent. Once the Promise resolves, all subsequent read operations will no longer see the provided key value pairs globally.
- Up to 1000 keys may be deleted per call.
- `list` R2Objects
containing a list of R2Object
contained within the bucket.
* The returned list of objects is ordered lexicographically.
* Returns up to 1000 entries, but may return less in order to minimize memory pressure within the Worker.
* To explicitly set the number of objects to list, provide an [R2ListOptions](/r2/api/workers/workers-api-reference/#r2listoptions) object with the `limit` property set.
* `createMultipartUpload`