Documentation Index Fetch the complete documentation index at: https://mintlify.com/cloudflare/workers-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Manage R2 buckets, objects, and bucket configurations from the command line.
Commands
Bucket Management
wrangler r2 bucket create
Create a new R2 bucket. wrangler r2 bucket create < nam e >
The name of the new bucket
Options: The optional location hint that determines geographic placement of the R2 bucket. Options: wnam, enam, weur, eeur, apac
The default storage class for objects uploaded to this bucket (alias: -s)
The jurisdiction where the new bucket will be created (alias: -J)
Automatically update your wrangler configuration file with the new bucket binding
The name of the binding to use in your wrangler configuration file
Example: wrangler r2 bucket create my-bucket
wrangler r2 bucket create my-bucket --location=wnam --storage-class=InfrequentAccess
wrangler r2 bucket create eu-bucket --jurisdiction=eu
Note: You cannot provide both --location and --jurisdiction.
List all R2 buckets in your account. Options: The jurisdiction to list (alias: -J)
Example: wrangler r2 bucket list
wrangler r2 bucket list --jurisdiction=eu
Get information about an R2 bucket. wrangler r2 bucket info < bucke t >
The name of the bucket to retrieve info for
Options: The jurisdiction where the bucket exists (alias: -J)
Return the bucket information as JSON
Example: wrangler r2 bucket info my-bucket
wrangler r2 bucket info my-bucket --json
wrangler r2 bucket delete
Delete an R2 bucket. wrangler r2 bucket delete < bucke t >
The name of the bucket to delete
Options: The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket delete my-bucket
wrangler r2 bucket delete eu-bucket --jurisdiction=eu
wrangler r2 bucket update storage-class
Update the default storage class of an existing R2 bucket. wrangler r2 bucket update storage-class < nam e > --storage-class < clas s >
The name of the existing bucket
Options: The new default storage class for this bucket (alias: -s)
The jurisdiction of the bucket to be updated (alias: -J)
Example: wrangler r2 bucket update storage-class my-bucket --storage-class=InfrequentAccess
Object Management
Fetch an object from an R2 bucket. wrangler r2 object get < objectPat h >
The source object path in the form of {bucket}/{key}
Options: The destination file to create (alias: -f)
Enables the file to be piped to a destination (alias: -p)
Interact with local storage
Interact with remote storage
Directory for local persistence
The jurisdiction where the object exists (alias: -J)
Example: wrangler r2 object get my-bucket/file.txt --file=./downloaded.txt
wrangler r2 object get my-bucket/file.txt --pipe > output.txt
Create an object in an R2 bucket. wrangler r2 object put < objectPat h >
The destination object path in the form of {bucket}/{key}
Options: The path of the file to upload (alias: -f)
Enables the file to be piped in (alias: -p)
A standard MIME type describing the format of the object data (alias: --ct)
Specifies presentational information for the object (alias: --cd)
Specifies what content encodings have been applied to the object (alias: --ce)
The language the content is in (alias: --cl)
Specifies caching behavior along the request/reply chain (alias: --cc)
The date and time at which the object is no longer cacheable
The storage class of the object to be created (alias: -s)
Interact with local storage
Interact with remote storage
Directory for local persistence
The jurisdiction where the object will be created (alias: -J)
Example: wrangler r2 object put my-bucket/file.txt --file=./local-file.txt
wrangler r2 object put my-bucket/image.jpg --file=./image.jpg --content-type=image/jpeg
cat file.txt | wrangler r2 object put my-bucket/file.txt --pipe
wrangler r2 object delete
Delete an object in an R2 bucket. wrangler r2 object delete < objectPat h >
The destination object path in the form of {bucket}/{key}
Options: Interact with local storage
Interact with remote storage
Directory for local persistence
The jurisdiction where the object exists (alias: -J)
Example: wrangler r2 object delete my-bucket/file.txt
CORS Configuration
wrangler r2 bucket cors list
List the CORS rules for an R2 bucket. wrangler r2 bucket cors list < bucke t >
The name of the R2 bucket to list the CORS rules for
Options: The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket cors list my-bucket
wrangler r2 bucket cors set
Set the CORS configuration for an R2 bucket from a JSON file. wrangler r2 bucket cors set < bucke t > --file < pat h >
The name of the R2 bucket to set the CORS configuration for
Options: Path to the JSON file containing the CORS configuration
The jurisdiction where the bucket exists (alias: -J)
Skip confirmation (alias: -y)
Example: wrangler r2 bucket cors set my-bucket --file=cors-config.json
The JSON file should contain a rules array following the R2 CORS API format .
wrangler r2 bucket cors delete
Clear the CORS configuration for an R2 bucket. wrangler r2 bucket cors delete < bucke t >
The name of the R2 bucket to delete the CORS configuration for
Options: The jurisdiction where the bucket exists (alias: -J)
Skip confirmation (alias: -y)
Example: wrangler r2 bucket cors delete my-bucket
Lifecycle Rules
wrangler r2 bucket lifecycle list
List lifecycle rules for an R2 bucket. wrangler r2 bucket lifecycle list < bucke t >
The name of the R2 bucket to list lifecycle rules for
Options: The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket lifecycle list my-bucket
wrangler r2 bucket lifecycle add
Add a lifecycle rule to an R2 bucket. wrangler r2 bucket lifecycle add < bucke t >
The name of the R2 bucket to add a lifecycle rule to
Options: A unique name for the lifecycle rule (alias: --id)
Prefix condition for the lifecycle rule (leave empty for all prefixes)
Number of days after which objects expire
Date after which objects expire (YYYY-MM-DD)
Number of days after which objects transition to Infrequent Access storage
Date after which objects transition to Infrequent Access storage (YYYY-MM-DD)
Number of days after which incomplete multipart uploads are aborted
The jurisdiction where the bucket exists (alias: -J)
Skip confirmation (alias: -y)
Example: wrangler r2 bucket lifecycle add my-bucket --name=expire-old --expire-days=30
wrangler r2 bucket lifecycle add my-bucket --name=transition --ia-transition-days=90 --prefix=logs/
wrangler r2 bucket lifecycle remove
Remove a lifecycle rule from an R2 bucket. wrangler r2 bucket lifecycle remove < bucke t > --name < rule-nam e >
The name of the R2 bucket to remove a lifecycle rule from
Options: The unique name of the lifecycle rule to remove (alias: --id)
The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket lifecycle remove my-bucket --name=expire-old
wrangler r2 bucket lifecycle set
Set the lifecycle configuration for an R2 bucket from a JSON file. wrangler r2 bucket lifecycle set < bucke t > --file < pat h >
The name of the R2 bucket to set lifecycle configuration for
Options: Path to the JSON file containing lifecycle configuration
The jurisdiction where the bucket exists (alias: -J)
Skip confirmation (alias: -y)
Example: wrangler r2 bucket lifecycle set my-bucket --file=lifecycle-config.json
Custom Domains
wrangler r2 bucket domain list
List custom domains for an R2 bucket. wrangler r2 bucket domain list < bucke t >
The name of the R2 bucket whose connected custom domains will be listed
Options: The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket domain list my-bucket
wrangler r2 bucket domain get
Get custom domain connected to an R2 bucket. wrangler r2 bucket domain get < bucke t > --domain < domai n >
The name of the R2 bucket whose custom domain to retrieve
Options: The custom domain to get information for
The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket domain get my-bucket --domain=assets.example.com
wrangler r2 bucket domain add
Connect a custom domain to an R2 bucket. wrangler r2 bucket domain add < bucke t > --domain < domai n > --zone-id < zone-i d >
The name of the R2 bucket to connect a custom domain to
Options: The custom domain to connect to the R2 bucket
The zone ID associated with the custom domain
Set the minimum TLS version for the custom domain (defaults to 1.0 if not set). Options: 1.0, 1.1, 1.2, 1.3
The jurisdiction where the bucket exists (alias: -J)
Skip confirmation (alias: -y)
Example: wrangler r2 bucket domain add my-bucket --domain=assets.example.com --zone-id=abc123 --min-tls=1.2
wrangler r2 bucket domain remove
Remove a custom domain from an R2 bucket. wrangler r2 bucket domain remove < bucke t > --domain < domai n >
The name of the R2 bucket to remove the custom domain from
Options: The custom domain to remove from the R2 bucket
The jurisdiction where the bucket exists (alias: -J)
Skip confirmation (alias: -y)
Example: wrangler r2 bucket domain remove my-bucket --domain=assets.example.com
wrangler r2 bucket domain update
Update settings for a custom domain connected to an R2 bucket. wrangler r2 bucket domain update < bucke t > --domain < domai n >
The name of the R2 bucket associated with the custom domain to update
Options: The custom domain whose settings will be updated
Update the minimum TLS version for the custom domain. Options: 1.0, 1.1, 1.2, 1.3
The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket domain update my-bucket --domain=assets.example.com --min-tls=1.3
Event Notifications
wrangler r2 bucket notification list
List event notification rules for an R2 bucket. wrangler r2 bucket notification list < bucke t >
The name of the R2 bucket to get event notification rules for
Options: The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket notification list my-bucket
wrangler r2 bucket notification create
Create an event notification rule for an R2 bucket. wrangler r2 bucket notification create < bucke t > --event-types < type s > --queue < queu e >
The name of the R2 bucket to create an event notification rule for
Options: The type of event(s) that will emit event notifications (alias: --event-type)
The name of the queue that will receive event notification messages
The prefix that an object must match to emit event notifications
The suffix that an object must match to emit event notifications
A description that can be used to identify the event notification rule after creation
The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket notification create my-bucket --event-types=object-create --queue=my-queue
wrangler r2 bucket notification create my-bucket --event-types=object-create --event-types=object-delete --queue=my-queue --prefix=uploads/
wrangler r2 bucket notification delete
Delete an event notification rule from an R2 bucket. wrangler r2 bucket notification delete < bucke t > --queue < queu e >
The name of the R2 bucket to delete an event notification rule for
Options: The name of the queue that corresponds to the event notification rule. If no rule is provided, all event notification rules associated with the bucket and queue will be deleted
The ID of the event notification rule to delete
The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket notification delete my-bucket --queue=my-queue
wrangler r2 bucket notification delete my-bucket --queue=my-queue --rule=rule-123
Sippy (Incremental Migration)
wrangler r2 bucket sippy enable
Enable Sippy on an R2 bucket for incremental migration from cloud storage. wrangler r2 bucket sippy enable < nam e >
Options: Cloud storage provider. Options: AWS, GCS
The name of the upstream bucket
The jurisdiction where the bucket exists (alias: -J)
AWS Options: The region of the upstream bucket (AWS only)
The secret access key id for the upstream bucket (AWS only)
The secret access key for the upstream bucket (AWS only)
GCS Options: --service-account-key-file
The path to your Google Cloud service account key JSON file (GCS only)
The client email for your Google Cloud service account key (GCS only)
The private key for your Google Cloud service account key (GCS only)
R2 Credentials: The secret access key id for this R2 bucket
The secret access key for this R2 bucket
Example: wrangler r2 bucket sippy enable my-bucket --provider=AWS --bucket=source-bucket --region=us-west-2 --access-key-id=KEY --secret-access-key=SECRET --r2-access-key-id=R2KEY --r2-secret-access-key=R2SECRET
wrangler r2 bucket sippy disable
Disable Sippy on an R2 bucket. wrangler r2 bucket sippy disable < nam e >
Options: The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket sippy disable my-bucket
wrangler r2 bucket sippy get
Check the status of Sippy on an R2 bucket. wrangler r2 bucket sippy get < nam e >
Options: The jurisdiction where the bucket exists (alias: -J)
Example: wrangler r2 bucket sippy get my-bucket