> r2
R2 is Cloudflare's S3-compatible object storage with zero egress fees, driven from Wrangler through two command groups: `wrangler r2 bucket ...` for buckets, public domains, CORS, lifecycle, and event notifications, and `wrangler r2 object ...` for moving files in and out. These scenarios cover the real loop a Workers engineer runs: create and bind a bucket, push and pull objects, expose it on the public web, and wire uploads into Workers and Queues.
// r2
10 commands$ wrangler r2 bucket create my-bucket$ wrangler r2 bucket list$ wrangler r2 object put my-bucket/images/logo.png --file=./logo.png --content-type=image/png --remote$ wrangler r2 object get my-bucket/images/logo.png --file=./logo.png --remote$ wrangler r2 object delete my-bucket/images/logo.png --remote$ wrangler r2 bucket dev-url enable my-bucket$ wrangler r2 bucket cors set my-bucket --file=./cors.json$ wrangler r2 bucket lifecycle add my-bucket$ wrangler r2 bucket notification create my-bucket --event-type object-create --queue my-queue$ wrangler dev// faq
Do wrangler r2 commands hit my real bucket or a local one?
The `wrangler r2 bucket ...` management commands (create, list, domain, cors, lifecycle, notification) always act on your real Cloudflare account. But `wrangler r2 object` and the R2 binding under `wrangler dev` default to a local simulated bucket persisted in `.wrangler/state` — pass `--remote` to read and write the real bucket and its data.
How big a file can I upload with wrangler r2 object put?
`wrangler r2 object put` is built for small files, config blobs, and one-offs; large objects (hundreds of MB and up) get slow or fail through a single put. For big or bulk uploads use the S3-compatible API via the aws CLI or rclone (which do multipart), or stream from inside a Worker.
How do I serve R2 files on the public web?
For quick testing, enable the managed `r2.dev` URL with `wrangler r2 bucket dev-url enable` — but it is heavily rate-limited and not for production. For real traffic attach a custom domain with `wrangler r2 bucket domain add --domain ... --zone-id ...` so requests flow through Cloudflare's cache and CDN, or proxy the bucket through a Worker for access control.