Skip to content

Backblaze B2

This guide walks you through connecting Sunshine Cloud Storage to Backblaze B2. Backblaze B2 is a low-cost S3-compatible storage provider.

What You Need

  • A Backblaze account
  • A B2 bucket
  • An application key with S3-compatible access

Step 1: Create a Bucket

In the Backblaze dashboard, go to B2 Cloud Storage > Buckets and click Create a Bucket. Choose a name and set the files to Private (Sunshine manages public/private access at the object level).

For full details, see Backblaze's documentation on creating buckets.

Step 2: Create an Application Key

Go to App Keys and click Add a New Application Key. You can create a key scoped to your specific bucket or a master key with access to all buckets.

After creating the key, you'll see a keyID and an applicationKey. Save both — the applicationKey is only shown once.

These are your S3-compatible credentials:

  • keyID = Access Key ID
  • applicationKey = Secret Access Key

For full details, see Backblaze's documentation on application keys.

Step 3: Connect in Sunshine

  1. Go to Sunshine Photo Cart > Settings > Cloud Storage.
  2. Select Backblaze B2 as the provider.
  3. Choose your connection method:
  4. Database — Enter your keyID as the Access Key and applicationKey as the Secret Key.
  5. wp-config.php (recommended) — Add the provided code snippet to your wp-config.php file.
  6. Click Load Buckets to see your available buckets, then select yours.
  7. Click Test Connection to verify everything works.

wp-config.php Example

define( 'SUNSHINE_CLOUD_STORAGE_SETTINGS', serialize( array(
    'provider'          => 'backblaze',
    'access-key-id'     => 'YOUR_KEY_ID',
    'secret-access-key' => 'YOUR_APPLICATION_KEY',
    'bucket'            => 'my-bucket-name',
) ) );

Learn how to add this custom code to your WordPress website

Using Cloudflare CDN (Optional)

Backblaze has a partnership with Cloudflare that eliminates egress fees when serving B2 files through Cloudflare's CDN. If you set this up, enter your Cloudflare domain in the Custom Domain field in Sunshine's Cloud Storage settings.

CORS Configuration

If images aren't loading in the WordPress admin but work fine on the frontend of your site, your bucket likely needs CORS (Cross-Origin Resource Sharing) headers. This allows the browser to load images from Backblaze B2 when you're managing galleries in WordPress.

In the Backblaze dashboard, go to B2 Cloud Storage > Buckets, find your bucket, and click Bucket Settings. Under CORS Rules, select Share everything in this bucket with every origin or add a custom rule:

  • Origins: *
  • Methods: GET, HEAD
  • Headers: *
  • Max Age: 86400

Using * for origins is safe here since these are publicly accessible images.

Troubleshooting

Bucket not appearing

Make sure your application key has access to the bucket you're trying to use. If you created a key scoped to a specific bucket, verify it matches.

Upload errors

Backblaze B2 uses path-style addressing (handled automatically by Sunshine). If you see endpoint errors, verify your bucket's region matches what Backblaze shows in the bucket details.

Still need help?

If you have not yet found your answer in the documentation articles, please contact support

Sunshine Photo Cart for WordPress