Cloudflare R2

The Cloudflare R2 integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] allows you to use Cloudflare R2 buckets with Home Assistant Backups.

Prerequisites

This integration requires an existing R2 bucket and admin access to the bucket so you can create a Secret Access Key.

Create a new Cloudflare R2 bucket
  1. Log in to your Cloudflare Dashboard.
  2. On the sidebar, go to Storage & databases, click on R2 object storage and then Overview.
  3. Select + Create bucket.
  4. Choose a unique Bucket name (e.g., home-assistant-backups-123456).
  5. Select your preferred location.
  6. Select your preferred storage class (Standard is fine, as Infrequent Access is still in beta)
  7. Select Create bucket.

Make a note of the bucket name — you’ll need it later.

Create an API Token/Secret Key

To create a new Secret Key that can access the R2 bucket:

  1. Go back to the R2 object storage > Overview page.
  2. Click Manage API Tokens.
  3. Click Create User API token.
  4. Give it a name like Home Assistant Backup.
  5. Check Object Read & Write.
  6. Click Apply to specific buckets only and chose the bucket you created previously (e.g., home-assistant-backups-123456).
  7. Do not touch the other options and click Create User API Token.
  8. Save the Access Key ID, the Secret Access Key and also the S3 endpoint — you’ll need these when setting up the Cloudflare R2 integration in Home Assistant.

Note

  • Avoid using credentials and API Keys that have more permissions than is necessary.

  • By limiting credentials to a specific bucket, you reduce risk and help keep your Cloudflare account secure.

Configuration

To add the Cloudflare R2 service to your Home Assistant instance, use this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

  • Browse to your Home Assistant instance.

  • Go to Settings > Devices & services.

  • In the bottom right corner, select the Add Integration button.

  • From the list, select Cloudflare R2.

  • Follow the instructions on screen to complete the setup.

Access key ID

Access key ID to connect to Cloudflare R2 (this is your Account ID).

Secret access key

Secret access key to connect to Cloudflare R2. See Cloudflare documentation

Bucket name

R2 bucket name to store the backups. Bucket must already exist and be writable by the provided credentials.

Endpoint URL

Cloudflare R2 S3-compatible endpoint.

Folder prefix

Optional folder path inside the bucket. For example, backups/homeassistant

Removing the integration

To remove an integration instance from Home Assistant

  1. Go to Settings > Devices & services and select the integration card.
  2. From the list of devices, select the integration instance you want to remove.
  3. Next to the entry, select the three dots menu. Then, select Delete.