Cloudflare R2

Here is a step-by-step guide to:

  1. create/select an R2 bucket
  2. find Cloudflare Account ID
  3. generate/find S3-compatible Access Key/Secret Key

Create/select account and open R2

  • Sign in to Cloudflare Dashboard (https://dash.cloudflare.com).
  • In the left nav bar, click "Storage & databases" → "R2 object storage" → Overview

Create/select a bucket

In the R2-Overview Page, on the right-hand panel:

  • Click "Create bucket".
  • Name: unique within your account.
  • Region: auto
  • Click "Create bucket".

Find your Account ID

In the R2-Overview Page, on the right-hand panel:

  • "Account Details" → "Account ID"

Generate/select S3-compatible Access/Secret keys (R2 API token)

In the R2-Overview Page, on the right-hand panel:

  • open "Account Details" → "API Tokens" → "{} Manage"
  • Click "Create Account API Tokens".
  • Input "Token name"
  • Choose "Object Read & Write" permissions.
  • In "Specify bucket(s)" section, Set scope to "All buckets" or select specific bucket(s) for least privilege.
  • Create token → you'll be shown:
    • Access Key ID
    • Secret Access Key (shown once)
  • Copy both immediately; store securely (secret won't be shown again).

Security and rotation tips

  • Periodically creating a new API token/key pair to replace the old one.

References