Wrangler commands
Interact with buckets in an R2 store.
Create a new R2 bucket
npx wrangler r2 bucket create [NAME]pnpm wrangler r2 bucket create [NAME]yarn wrangler r2 bucket create [NAME]-
[NAME]string requiredThe name of the new bucket
-
--locationstringThe optional location hint that determines geographic placement of the R2 bucket
-
--storage-classstring alias: --sThe default storage class for objects uploaded to this bucket
-
--jurisdictionstring alias: --JThe jurisdiction where the new bucket will be created
-
--use-remotebooleanUse a remote binding when adding the newly created resource to your config
-
--update-configbooleanAutomatically update your config file with the newly added resource
-
--bindingstringThe binding name of this resource in your Worker
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Get information about an R2 bucket
npx wrangler r2 bucket info [BUCKET]pnpm wrangler r2 bucket info [BUCKET]yarn wrangler r2 bucket info [BUCKET]-
[BUCKET]string requiredThe name of the bucket to retrieve info for
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--jsonboolean default: falseReturn the bucket information as JSON
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Delete an R2 bucket
npx wrangler r2 bucket delete [BUCKET]pnpm wrangler r2 bucket delete [BUCKET]yarn wrangler r2 bucket delete [BUCKET]-
[BUCKET]string requiredThe name of the bucket to delete
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
List R2 buckets
npx wrangler r2 bucket listpnpm wrangler r2 bucket listyarn wrangler r2 bucket list-
--jurisdictionstring alias: --JThe jurisdiction to list
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Enable the data catalog on an R2 bucket
npx wrangler r2 bucket catalog enable [BUCKET]pnpm wrangler r2 bucket catalog enable [BUCKET]yarn wrangler r2 bucket catalog enable [BUCKET]-
[BUCKET]string requiredThe name of the bucket to enable
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Disable the data catalog for an R2 bucket
npx wrangler r2 bucket catalog disable [BUCKET]pnpm wrangler r2 bucket catalog disable [BUCKET]yarn wrangler r2 bucket catalog disable [BUCKET]-
[BUCKET]string requiredThe name of the bucket to disable the data catalog for
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Get the status of the data catalog for an R2 bucket
npx wrangler r2 bucket catalog get [BUCKET]pnpm wrangler r2 bucket catalog get [BUCKET]yarn wrangler r2 bucket catalog get [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket whose data catalog status to retrieve
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Enable automatic file compaction for your R2 data catalog or a specific table
npx wrangler r2 bucket catalog compaction enable [BUCKET] [NAMESPACE] [TABLE]pnpm wrangler r2 bucket catalog compaction enable [BUCKET] [NAMESPACE] [TABLE]yarn wrangler r2 bucket catalog compaction enable [BUCKET] [NAMESPACE] [TABLE]-
[BUCKET]string requiredThe name of the bucket which contains the catalog
-
[NAMESPACE]stringThe namespace containing the table (optional, for table-level compaction)
-
[TABLE]stringThe name of the table (optional, for table-level compaction)
-
--target-sizenumber default: 128The target size for compacted files in MB (allowed values: 64, 128, 256, 512)
-
--tokenstringA cloudflare api token with access to R2 and R2 Data Catalog (required for catalog-level compaction settings only)
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Examples:
# Enable catalog-level compaction (requires token)npx wrangler r2 bucket catalog compaction enable my-bucket --token <TOKEN>
# Enable table-level compactionnpx wrangler r2 bucket catalog compaction enable my-bucket my-namespace my-table --target-size 256Disable automatic file compaction for your R2 data catalog or a specific table
npx wrangler r2 bucket catalog compaction disable [BUCKET] [NAMESPACE] [TABLE]pnpm wrangler r2 bucket catalog compaction disable [BUCKET] [NAMESPACE] [TABLE]yarn wrangler r2 bucket catalog compaction disable [BUCKET] [NAMESPACE] [TABLE]-
[BUCKET]string requiredThe name of the bucket which contains the catalog
-
[NAMESPACE]stringThe namespace containing the table (optional, for table-level compaction)
-
[TABLE]stringThe name of the table (optional, for table-level compaction)
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Examples:
# Disable catalog-level compactionnpx wrangler r2 bucket catalog compaction disable my-bucket
# Disable table-level compactionnpx wrangler r2 bucket catalog compaction disable my-bucket my-namespace my-tableSet the CORS configuration for an R2 bucket from a JSON file
npx wrangler r2 bucket cors set [BUCKET]pnpm wrangler r2 bucket cors set [BUCKET]yarn wrangler r2 bucket cors set [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to set the CORS configuration for
-
--filestring requiredPath to the JSON file containing the CORS configuration
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Clear the CORS configuration for an R2 bucket
npx wrangler r2 bucket cors delete [BUCKET]pnpm wrangler r2 bucket cors delete [BUCKET]yarn wrangler r2 bucket cors delete [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to delete the CORS configuration for
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
List the CORS rules for an R2 bucket
npx wrangler r2 bucket cors list [BUCKET]pnpm wrangler r2 bucket cors list [BUCKET]yarn wrangler r2 bucket cors list [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to list the CORS rules for
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Enable public access via the r2.dev URL for an R2 bucket
npx wrangler r2 bucket dev-url enable [BUCKET]pnpm wrangler r2 bucket dev-url enable [BUCKET]yarn wrangler r2 bucket dev-url enable [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to enable public access via its r2.dev URL
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Disable public access via the r2.dev URL for an R2 bucket
npx wrangler r2 bucket dev-url disable [BUCKET]pnpm wrangler r2 bucket dev-url disable [BUCKET]yarn wrangler r2 bucket dev-url disable [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to disable public access via its r2.dev URL
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Get the r2.dev URL and status for an R2 bucket
npx wrangler r2 bucket dev-url get [BUCKET]pnpm wrangler r2 bucket dev-url get [BUCKET]yarn wrangler r2 bucket dev-url get [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket whose r2.dev URL status to retrieve
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Connect a custom domain to an R2 bucket
npx wrangler r2 bucket domain add [BUCKET]pnpm wrangler r2 bucket domain add [BUCKET]yarn wrangler r2 bucket domain add [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to connect a custom domain to
-
--domainstring requiredThe custom domain to connect to the R2 bucket
-
--zone-idstring requiredThe zone ID associated with the custom domain
-
--min-tlsstringSet the minimum TLS version for the custom domain (defaults to 1.0 if not set)
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Remove a custom domain from an R2 bucket
npx wrangler r2 bucket domain remove [BUCKET]pnpm wrangler r2 bucket domain remove [BUCKET]yarn wrangler r2 bucket domain remove [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to remove the custom domain from
-
--domainstring requiredThe custom domain to remove from the R2 bucket
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Update settings for a custom domain connected to an R2 bucket
npx wrangler r2 bucket domain update [BUCKET]pnpm wrangler r2 bucket domain update [BUCKET]yarn wrangler r2 bucket domain update [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket associated with the custom domain to update
-
--domainstring requiredThe custom domain whose settings will be updated
-
--min-tlsstringUpdate the minimum TLS version for the custom domain
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Get custom domain connected to an R2 bucket
npx wrangler r2 bucket domain get [BUCKET]pnpm wrangler r2 bucket domain get [BUCKET]yarn wrangler r2 bucket domain get [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket whose custom domain to retrieve
-
--domainstring requiredThe custom domain to get information for
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
List custom domains for an R2 bucket
npx wrangler r2 bucket domain list [BUCKET]pnpm wrangler r2 bucket domain list [BUCKET]yarn wrangler r2 bucket domain list [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket whose connected custom domains will be listed
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Add a lifecycle rule to an R2 bucket
npx wrangler r2 bucket lifecycle add [BUCKET] [NAME] [PREFIX]pnpm wrangler r2 bucket lifecycle add [BUCKET] [NAME] [PREFIX]yarn wrangler r2 bucket lifecycle add [BUCKET] [NAME] [PREFIX]-
[BUCKET]string requiredThe name of the R2 bucket to add a lifecycle rule to
-
[NAME]string alias: --idA unique name for the lifecycle rule, used to identify and manage it.
-
[PREFIX]stringPrefix condition for the lifecycle rule (leave empty for all prefixes)
-
--expire-daysnumberNumber of days after which objects expire
-
--expire-datestringDate after which objects expire (YYYY-MM-DD)
-
--ia-transition-daysnumberNumber of days after which objects transition to Infrequent Access storage
-
--ia-transition-datestringDate after which objects transition to Infrequent Access storage (YYYY-MM-DD)
-
--abort-multipart-daysnumberNumber of days after which incomplete multipart uploads are aborted
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Remove a lifecycle rule from an R2 bucket
npx wrangler r2 bucket lifecycle remove [BUCKET]pnpm wrangler r2 bucket lifecycle remove [BUCKET]yarn wrangler r2 bucket lifecycle remove [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to remove a lifecycle rule from
-
--namestring alias: --id requiredThe unique name of the lifecycle rule to remove
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
List lifecycle rules for an R2 bucket
npx wrangler r2 bucket lifecycle list [BUCKET]pnpm wrangler r2 bucket lifecycle list [BUCKET]yarn wrangler r2 bucket lifecycle list [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to list lifecycle rules for
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Set the lifecycle configuration for an R2 bucket from a JSON file
npx wrangler r2 bucket lifecycle set [BUCKET]pnpm wrangler r2 bucket lifecycle set [BUCKET]yarn wrangler r2 bucket lifecycle set [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to set lifecycle configuration for
-
--filestring requiredPath to the JSON file containing lifecycle configuration
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Add a lock rule to an R2 bucket
npx wrangler r2 bucket lock add [BUCKET] [NAME] [PREFIX]pnpm wrangler r2 bucket lock add [BUCKET] [NAME] [PREFIX]yarn wrangler r2 bucket lock add [BUCKET] [NAME] [PREFIX]-
[BUCKET]string requiredThe name of the R2 bucket to add a bucket lock rule to
-
[NAME]string alias: --idA unique name for the bucket lock rule, used to identify and manage it.
-
[PREFIX]stringPrefix condition for the bucket lock rule (set to "" for all prefixes)
-
--retention-daysnumberNumber of days which objects will be retained for
-
--retention-datestringDate after which objects will be retained until (YYYY-MM-DD)
-
--retention-indefinitebooleanRetain objects indefinitely
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Remove a bucket lock rule from an R2 bucket
npx wrangler r2 bucket lock remove [BUCKET]pnpm wrangler r2 bucket lock remove [BUCKET]yarn wrangler r2 bucket lock remove [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to remove a bucket lock rule from
-
--namestring alias: --id requiredThe unique name of the bucket lock rule to remove
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
List lock rules for an R2 bucket
npx wrangler r2 bucket lock list [BUCKET]pnpm wrangler r2 bucket lock list [BUCKET]yarn wrangler r2 bucket lock list [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to list lock rules for
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Set the lock configuration for an R2 bucket from a JSON file
npx wrangler r2 bucket lock set [BUCKET]pnpm wrangler r2 bucket lock set [BUCKET]yarn wrangler r2 bucket lock set [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to set lock configuration for
-
--filestring requiredPath to the JSON file containing lock configuration
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--forceboolean alias: --y default: falseSkip confirmation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Create an event notification rule for an R2 bucket
npx wrangler r2 bucket notification create [BUCKET]pnpm wrangler r2 bucket notification create [BUCKET]yarn wrangler r2 bucket notification create [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to create an event notification rule for
-
--event-types"object-create" | "object-delete" alias: --event-type requiredThe type of event(s) that will emit event notifications
-
--prefixstringThe prefix that an object must match to emit event notifications (note: regular expressions not supported)
-
--suffixstringThe suffix that an object must match to emit event notifications (note: regular expressions not supported)
-
--queuestring requiredThe name of the queue that will receive event notification messages
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--descriptionstringA description that can be used to identify the event notification rule after creation
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Delete an event notification rule from an R2 bucket
npx wrangler r2 bucket notification delete [BUCKET]pnpm wrangler r2 bucket notification delete [BUCKET]yarn wrangler r2 bucket notification delete [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to delete an event notification rule for
-
--queuestring requiredThe 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
-
--rulestringThe ID of the event notification rule to delete
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
List event notification rules for an R2 bucket
npx wrangler r2 bucket notification list [BUCKET]pnpm wrangler r2 bucket notification list [BUCKET]yarn wrangler r2 bucket notification list [BUCKET]-
[BUCKET]string requiredThe name of the R2 bucket to get event notification rules for
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Enable Sippy on an R2 bucket
npx wrangler r2 bucket sippy enable [NAME]pnpm wrangler r2 bucket sippy enable [NAME]yarn wrangler r2 bucket sippy enable [NAME]-
[NAME]string requiredThe name of the bucket
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
-
--provider"AWS" | "GCS" -
--bucketstringThe name of the upstream bucket
-
--regionstring(AWS provider only) The region of the upstream bucket
-
--access-key-idstring(AWS provider only) The secret access key id for the upstream bucket
-
--secret-access-keystring(AWS provider only) The secret access key for the upstream bucket
-
--service-account-key-filestring(GCS provider only) The path to your Google Cloud service account key JSON file
-
--client-emailstring(GCS provider only) The client email for your Google Cloud service account key
-
--private-keystring(GCS provider only) The private key for your Google Cloud service account key
-
--r2-access-key-idstringThe secret access key id for this R2 bucket
-
--r2-secret-access-keystringThe secret access key for this R2 bucket
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Disable Sippy on an R2 bucket
npx wrangler r2 bucket sippy disable [NAME]pnpm wrangler r2 bucket sippy disable [NAME]yarn wrangler r2 bucket sippy disable [NAME]-
[NAME]string requiredThe name of the bucket
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Check the status of Sippy on an R2 bucket
npx wrangler r2 bucket sippy get [NAME]pnpm wrangler r2 bucket sippy get [NAME]yarn wrangler r2 bucket sippy get [NAME]-
[NAME]string requiredThe name of the bucket
-
--jurisdictionstring alias: --JThe jurisdiction where the bucket exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Interact with R2 objects.
Fetch an object from an R2 bucket
npx wrangler r2 object get [OBJECTPATH]pnpm wrangler r2 object get [OBJECTPATH]yarn wrangler r2 object get [OBJECTPATH]-
[OBJECTPATH]string requiredThe source object path in the form of {bucket}/{key}
-
--filestring alias: --fThe destination file to create
-
--pipeboolean alias: --pEnables the file to be piped to a destination, rather than specified with the --file option
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
-
--jurisdictionstring alias: --JThe jurisdiction where the object exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Create an object in an R2 bucket
npx wrangler r2 object put [OBJECTPATH]pnpm wrangler r2 object put [OBJECTPATH]yarn wrangler r2 object put [OBJECTPATH]-
[OBJECTPATH]string requiredThe destination object path in the form of {bucket}/{key}
-
--filestring alias: --fThe path of the file to upload
-
--pipeboolean alias: --pEnables the file to be piped in, rather than specified with the --file option
-
--content-typestring alias: --ctA standard MIME type describing the format of the object data
-
--content-dispositionstring alias: --cdSpecifies presentational information for the object
-
--content-encodingstring alias: --ceSpecifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field
-
--content-languagestring alias: --clThe language the content is in
-
--cache-controlstring alias: --ccSpecifies caching behavior along the request/reply chain
-
--expiresstringThe date and time at which the object is no longer cacheable
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
-
--jurisdictionstring alias: --JThe jurisdiction where the object will be created
-
--storage-classstring alias: --sThe storage class of the object to be created
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Delete an object in an R2 bucket
npx wrangler r2 object delete [OBJECTPATH]pnpm wrangler r2 object delete [OBJECTPATH]yarn wrangler r2 object delete [OBJECTPATH]-
[OBJECTPATH]string requiredThe destination object path in the form of {bucket}/{key}
-
--localbooleanInteract with local storage
-
--remotebooleanInteract with remote storage
-
--persist-tostringDirectory for local persistence
-
--jurisdictionstring alias: --JThe jurisdiction where the object exists
Global flags
-
--vboolean alias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstring alias: --cPath to Wrangler configuration file
-
--envstring alias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionboolean aliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createboolean alias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark