Connect a Cloudflare R2 bucket
Cloudflare says R2 has no egress charges, which suits files that are read often, such as music and video. Connect it with an R2 API token that has Object Read & Write on one bucket.
Before you start
- A Cloudflare account with R2 set up. Cloudflare asks you to add R2 to your account before you can create R2 tokens.
Step by step
- In the Cloudflare dashboard, open R2 object storage and create a bucket, or use one you have.
- On the R2 overview page, under Account Details, choose Manage next to API Tokens, then Create Account API token.
- Under Permissions, choose Object Read & Write and limit the token to your bucket only. Create the token.
- Copy the Access Key ID and the Secret Access Key now: Cloudflare does not show the secret again. Note your Cloudflare account ID as well, because it is part of the endpoint.
- In the CoreHost control panel, go to Your storage and add a connection. Choose Cloudflare R2, fill in the fields as shown below and save.
- We save the connection and test it straight away. The result is one sentence, for example "Connected. 4 folders found. We can write here." If something is wrong, it says what, such as a key that was refused or a bucket that was not found.
- Open the app that should use the storage, go to its Storage section and attach the connection. Pick the folder in your storage, the path in the app (
/mnt/storageunless the app needs another) and Read only if the app only needs to read. The folder appears in the running app within about 15 seconds, without a restart.
What to fill in
In Your storage, add a connection, choose Cloudflare R2 and fill in these fields.
- Name
- Any name you like, for example
R2 music - Endpoint
your-account-id.r2.cloudflarestorage.com, with your Cloudflare account ID- Region
auto- Bucket
- The bucket name
- Access key ID
- The Access Key ID of the token
- Secret access key (kept encrypted, never shown again)
- The Secret Access Key of the token
- Folder (optional)
- Leave it empty to use the whole bucket. You pick the folder for each app when you attach it.
- Cache size (optional)
- 2, 5, 10 or 20 GiB. The default suits most apps. Pick a larger size for a media library that plays the same files again.
- Read only (optional)
- Tick it if the token has Object Read only, so the test does not try to write
After you save, we never show a secret again: the panel shows only its last four characters. To change one, enter the new value. A secret you leave empty when you edit the connection keeps the stored one.
Good to know
- If your bucket was created in a jurisdiction, such as the EU, use that jurisdiction's endpoint, for example
your-account-id.eu.r2.cloudflarestorage.com. - Pick an Account API token rather than a User API token. Cloudflare says user tokens stop working if your user is removed from the account.
- Object Read only works for a read-only connection. Tick Read only when you add it.
What your provider charges
Cloudflare says there are no charges for egress bandwidth on R2. It bills storage and operations (Class A operations mostly change data, Class B operations mostly read it), with a monthly free allowance. A media app that scans a big library makes many operations, so check the R2 pricing page.
Backups
Connected storage is not part of CoreHost backups, which cover the app's own data only. Back up what is in your storage with your provider. Detaching a folder or removing a connection never deletes anything in your storage. How connected storage works.
Using the folder in your app
The folder appears at /mnt/storage unless you chose another path. Point the app at it, or at a folder inside it, for example a music or audiobook library. The overview has tips for media apps and explains the cache and what happens if your storage cannot be reached.
Keep readingOther storage guides
Sources
- Cloudflare Docs, R2 authentication and API tokens: Account API tokens, Object Read & Write, one bucket scope, the endpoint and jurisdictions
- Cloudflare Docs, R2 S3 API compatibility: the endpoint and the auto region
- Cloudflare Docs, R2 pricing: egress, operations and the free allowance
We checked these steps against the provider's own documentation on 2 December 2026. Consoles change, so if something here is out of date, email support@corehost.io and we will correct it. Cloudflare is an independent company. CoreHost is not affiliated with Cloudflare, and this page is not endorsed by it.
Put your library to work
Every new account starts with $5 of credit, no card needed. Deploy an app such as Navidrome or Audiobookshelf, then connect your storage from the control panel.