Create an R2 Bucket and Bind It to a Worker
r2
// what it does
Provisions a new bucket on your account. Optionally add a `--location` hint (e.g. `weur`, `enam`) to place data near your users, or `--storage-class InfrequentAccess` for cold data. This is step one before your Worker can read or write objects.
// shell
$ wrangler r2 bucket create my-bucket// gotcha
Creating the bucket does not bind it — add an `r2_buckets` entry (`{ "binding": "MY_BUCKET", "bucket_name": "my-bucket" }`) to your wrangler config and redeploy before `env.MY_BUCKET` works. Bucket names must be unique within your account and cannot be renamed.