Docs

Backblaze B2

4 min readUpdated June 28, 2026

Backblaze B2 is a low-cost S3-compatible cloud storage service. It is one of the most affordable options for raw storage and works well when paired with a CDN that has a peering agreement with Backblaze, such as Bunny CDN or Cloudflare, which eliminates egress fees entirely on those combinations. WP Media Cloud connects to B2 using S3-compatible credentials.

Before you start#

You will need:

  • A Backblaze account. Create one at backblaze.com.
  • A B2 bucket.
  • A B2 application key with read and write access to the bucket.

Step 1: Create a B2 bucket#

Log in to the Backblaze console and go to B2 Cloud Storage > Buckets. Click Create a Bucket. Give the bucket a name — bucket names must be globally unique across all Backblaze accounts. Under Files in Bucket, select Public if you want files accessible without signed URLs, or Private if you want to restrict access. For most WordPress media use cases, select Public.

Click Create a Bucket.

Step 2: Create an application key#

Go to Account > Application Keys and click Add a New Application Key. Configure the key as follows:

  • Name — give it a descriptive name such as wp-media-cloud
  • Allow access to Bucket — select your specific bucket rather than all buckets
  • Type of Access — select Read and Write

Click Create New Key. Copy and save the keyID and applicationKey before closing the dialog — the application key is only shown once.

Also note the S3 Endpoint shown on the key creation page. It will be in the format s3.[region].backblazeb2.com such as s3.us-west-004.backblazeb2.com. You will need the region portion of this URL.

Step 3: Connect Backblaze B2 in WP Media Cloud#

You have two options for connecting B2 to WP Media Cloud. Use whichever suits your setup.

Option A: Setup wizard

Go to WP Media Cloud > Setup Wizard. The wizard walks you through provider selection, credential entry, and CDN configuration. This is the recommended option for most users.

Option B: wp-config.php constants

Add the following constants above the /* That's all, stop editing! */ line in wp-config.php:

define( 'WPMC_PROVIDER',       'b2' );
define( 'WPMC_B2_REGION',      'us-west-004' );
define( 'WPMC_B2_ACCESS_KEY',  'your-keyID' );
define( 'WPMC_B2_SECRET_KEY',  'your-applicationKey' );
define( 'WPMC_B2_BUCKET',      'your-bucket-name' );
define( 'WPMC_B2_CDN_TYPE',    'custom' );
define( 'WPMC_B2_CDN_URL',     'https://your-cdn.com' );

Set WPMC_B2_REGION to the region portion of your S3 endpoint URL. For example if your endpoint is s3.us-west-004.backblazeb2.com, the region is us-west-004. Enter the keyID as the access key and the applicationKey as the secret key. Once the constants are in place, go to WP Media Cloud > Settings > Storage and confirm the plugin has loaded them. Constants override any values saved in the settings panel.

Step 4: Test the connection#

Click Test Connection. WP Media Cloud will upload a small test file to your B2 bucket and confirm it can be read back. A green success message confirms the connection is working.

Backblaze B2 charges egress fees for downloads served directly from the bucket. To eliminate egress fees, use a CDN that has a bandwidth alliance or peering agreement with Backblaze:

  • Bunny CDN — has a peering agreement with Backblaze. Traffic between B2 and Bunny CDN is free. Create a Bunny pull zone with your B2 bucket’s public URL as the origin and enter the Bunny pull zone hostname in WP Media Cloud > Settings > CDN.
  • Cloudflare CDN — Cloudflare and Backblaze have a bandwidth alliance. Proxying B2 through a Cloudflare Worker or custom domain eliminates egress fees. Refer to Backblaze’s documentation for the Cloudflare integration setup.

Without a CDN, every image request served to a visitor counts as egress from B2 and is billed accordingly.

Troubleshooting#

Connection test returns Access Denied or 401
The keyID or applicationKey is incorrect, or the key does not have read and write access to the bucket. Confirm the key is active in the Backblaze console under Account > Application Keys. If the applicationKey was lost, create a new key.

Connection test returns endpoint error
The region code is incorrect. It must match the region in your S3 endpoint URL exactly, including the numeric suffix (e.g. us-west-004 not us-west). Find the correct value in the S3 endpoint shown on your bucket or application key page.

Bucket not found
B2 bucket names are case-sensitive and must match exactly. Confirm the bucket name in the Backblaze console.

Files upload but return 403 when accessed publicly
The bucket was created as Private. Go to B2 Cloud Storage > Buckets, click on the bucket, and check its settings. To change a bucket from Private to Public, click Edit Bucket Info and change the setting.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only