Integrate Fastly CDN with Backblaze B2
    • Dark
      Light

    Integrate Fastly CDN with Backblaze B2

    • Dark
      Light

    Article Summary

    The Fastly Content Delivery Network (CDN) lets you cache your data using multiple servers across the world, dramatically reducing the amount of latency involved with accessing it. You can set up Fastly CDN as a front end for your public Backblaze B2 Cloud Storage bucket. 

    Enable Backblaze B2

    Before you begin: You must have a Backblaze B2 Cloud Storage account. You can sign up here. If you already have a Backblaze account and the left navigation menu contains a B2 Cloud Storage section, your account is already enabled for Backblaze B2.

    1. Sign in to your Backblaze account.
    2. In the left navigation menu under Account, click My Settings.
    3. Under Enabled Products, select the checkbox to enable B2 Cloud Storage.
    4. Review the Terms and Conditions, and click OK to accept them. 

    Create a Bucket

    You must create a public bucket.

    1. Sign in to your Backblaze account.
    2. In the left navigation menu under B2 Cloud Storage, click Buckets.
    3. Click Create a Bucket.
    4. Enter a name for your bucket.
      Bucket names must be at least six characters and globally unique. A message is displayed if your bucket name is already in use.
    5. Select a privacy setting: Private or Public.
      Files that are in a private bucket require authentication to perform an action, for example, downloading. Public buckets do not require authentication so you can easily share files. You can change a bucket's privacy settings at any time.
    6. If applicable, enable a Backblaze B2 server-side encryption key.
    7. Enable Object Lock to restrict a file from being modified or deleted for a specified period of time.
    8. Click Create a Bucket, and copy the value that is in the Endpoint field; you may need this value for other processes.
    9. Click Lifecycle Settings to control how long to keep the files in your new bucket.

    Upload a File

    You must upload a file to note the S3 URL for your hostname.

    1. Sign in to your Backblaze account.
    2. In the left navigation menu under B2 Cloud Storage, click Buckets.
    3. In your bucket details, click Upload/Download and click Upload.
    4. Drop your image from your local drive into the dialog box, or manually select your file.
    5. Click Browse Files to see your uploaded file, and click the image filename to see more details.
    6. In the S3 URL field, note the value, for example, https://<bucketname>.s3.us-west-000.backblazeb2.com/<imagename.jpeg>.

    Configure the Fastly Service

    Before you begin: You must have a configured domain name. If you do not have one, configure one that will at least temporarily (until the domain is registered) be addressable at the address <domain>.global.prod.fastly.net.

    1. Under Domains, enter your domain and domain name, and click Add.
    2. In the left navigation menu under Origins, select Hosts.
    3. Click Create a host, and, as the hostname, enter the S3 URL without the bucket name, for example, s3.us-west-000.backblazeb2.com.
    4. Click(edit) next to the hostname you just created.
    5. Edit the parameters of the host.
      1. Ensure that the Certificate hostname and the SNI hostname are the same as the hostname.
      2. In the Override host field, enter the full S3 URL, for example, https://<bucketname>.s3.us-west-000.backblazeb2.com.
      3. Click Update
    6. Activate the service.

    You can navigate to any object that is stored in your Backblaze B2 bucket by appending its path to your domain name. For example, navigating to <domain>.global.prod.fastly.net/<imagename.jpeg> displays the image that you uploaded.


    Was this article helpful?