Setup
R2 signs S3 requests with an R2 API token’s key pair.- In the Cloudflare dashboard, open R2 object storage > Overview.
- Under Account Details, pick Manage next to API Tokens, then Create Account API token (or Create User API token).
- Under Permissions, choose Object Read only, or Object Read & Write for writes, and scope the token to the bucket.
- Create the token and copy the Access Key ID and Secret Access Key. Cloudflare shows the secret only once.
- Copy the Account ID from Account Details (it is also in the dashboard URL).
- The account ID builds the endpoint
https://<account-id>.r2.cloudflarestorage.com. - A bucket in a jurisdiction has its own endpoint, such as
https://<account-id>.eu.r2.cloudflarestorage.com; setendpoint_url(endpointin TypeScript) to it.
Connect
- YAML
- Python
- TypeScript
workspace.yaml
Layout
- Each object key is a file path; folders are key prefixes, and the bucket holds no directory objects.
key_prefix(keyPrefixin TypeScript) mounts one subpath of the bucket as the root.grep -r,findanddustop after 1000 files; a glob matching more,tar -c,cp -randrm -rare refused.
Sample runs
write mount, redirects, cp, mv and rm change objects in the bucket.
For write: conditional, see S3-compatible VFSes.
SDK guides
Python
Every config field, the VFS.md and write support.
TypeScript
Every config field, the VFS.md and write support.