On this page

Saving to Backblaze B2

Introduction

This tutorial aims to provide guidance on saving files to Backblaze B2, a cost-effective and high-performance cloud storage service, using both its native B2 protocol and the S3 compatibility mode.

By the end of this tutorial, you'll be able to set up a destination object for saving files to Backblaze B2, with an understanding of both B2 and S3-compatible URL structures, credentials, and access permissions.

Supported Protocols

ProtocolDescription
s3://Backblaze B2 Storage in S3-Compatible Mode
b2://Backblaze B2 Storage Protocol

1
Configuring Backblaze B2 for S3 Compatibility

  1. Access your Backblaze B2 account and navigate to the S3-compatible settings.
  2. Note the Endpoint URL, which includes your specific Backblaze B2 region.

2
Creating a Bucket in Backblaze B2

  1. Sign in to your Backblaze B2 account.
  2. Navigate to the Buckets section and create a new bucket.
  3. Choose a name for your bucket, keeping in mind the privacy settings (public or private).

3
Finding Your Backblaze B2 Credentials

  1. In your Backblaze B2 account, go to the App Keys section.
  2. Create a new application key (keyID) and note the application key (applicationKey).

Please also see Create and Manage App Keys for more details. For a comprehensive overview and a list of supported features, please consult the official Backblaze documentation.

4
Saving Output to Backblaze B2

In order to save your outputs to your Backblaze B2 Storage, define your destination object using the following structure.

Destination Object Structure

"destination": {
  "url": "s3://s3.[region].backblazeb2.com/bucket/path",
  "key": "b2_key_id",
  "secret": "b2_application_key",
  "permissions": "permissions"
}

"destination": {
  "url": "b2://backblaze.com/bucket/path",
  "key": "b2_key_id",
  "secret": "b2_application_key",
  "permissions": "permissions"
}

Attributes of Backblaze Destination Object

AttributeDescription
urlYour Backblaze Destination URL. Includes the bucket, region if applicable, and path.
keyYour Backblaze B2 key ID.
secretYour Backblaze B2 application key.
permissionsSpecifies object access permissions. The default value is ‘private’ meaning the object is not publicly accessible with its URL. In case you want your objects to be accessed publicly, specify ‘public-read’ as a value for permissions.

URL Structure for Backblaze

The Backblaze URL consists of a bucket, path, and region if using S3 compatibity mode.

s3://s3.[region].backblazeb2.com/[bucket]/[path]

b2://backblaze.com/[bucket]/[path]

Components of URL
regionOptional. Region of the bucket.
bucketThe bucket of the destination you want to use.
pathThe complete path of the output, including the filename.

Destination Object Example

"destination": {
  "url": "s3://s3.us-west-000.backblazeb2.com/my-bucket/folder/output.mp4",
  "key": "myB2KeyId",
  "secret": "myB2ApplicationKey",
  "permissions": "public-read"
}

"destination": {
  "url": "b2://backblaze.com/my-bucket/folder/output.mp4",
  "key": "myB2KeyId",
  "secret": "myB2ApplicationKey",
  "permissions": "public-read"
}

When saving ABR outputs like HLS or DASH, please specify the path to a folder where the contents of the HLS or DASH stream should be located:

"destination": {
  "url": "s3://s3.us-west-000.backblazeb2.com/my-bucket/folder",
  "key": "myB2KeyId",
  "secret": "myB2ApplicationKey",
  "permissions": "public-read"
}

Considerations

  • Cost-Effectiveness and Performance: Backblaze B2 offers competitive pricing and high performance.
  • Region Consistency and Access Permissions: For S3 compatibility, ensure the region matches and select appropriate permissions.
  • Security and Privacy: Decide on the privacy settings for your bucket based on your requirements.
  • Connectivity Issues: Verify the region and bucket name in the URL for S3 compatibility mode and the accuracy of the URL for the B2 protocol.
  • Authentication Errors: Double-check your key ID and application key for both modes.
  • Explore advanced features and integrations of Backblaze B2 to enhance your cloud storage experience.