Backblaze Object Storage



Backblaze is an online backup tool that allows Windows and Mac OS X users toback up their data to an offsite data center.

  • Replicating to Backblaze B2. This guide will show you how to use Backblaze B2 as a database replica path for Litestream. Create a bucket# To begin, you’ll need a bucket to store your data. If you don’t already have one set up in Backblaze, follow the steps below: From your Backblaze dashboard, go to My Account Buckets; Click “Create a.
  • See the full review - This video compares the backup speeds of two object storage companies: Backbla.
  • Founded in 2007, Backblaze B2 is one of the cheapest object storage providers available today. Advertising itself as 1/4th the price of Amazon S3, the price for B2 is $0.005/GB/mo for storage and $0.01/GB for downloads. The first 10 GB is free too. Visit Backblaze B2.
  • Backblaze is a pioneer in robust, scalable low cost cloud backup and storage services. Personal online backup to enterprise scale data storage solutions. The Easy, Affordable, Trusted Storage Cloud Grow your business with easy to use object storage that doesn't break your budget. Meet B2 Cloud Storage. Backing up your computer?

Backblaze B2 is their cloud object storage offering similar to Amazon S3 andother object storage services.

S3 object storage workflow Secure storage of S3 access keys Upload files to an S3 bucket with verification List S3 bucket contents and select files Download files from S3 bucket Support for AWS, Backblaze and Wasabi S3 cloud storage Directly uploading from tape or downloading to tape is not recommended.

Instantiating a driver¶

To instantiate the driver you need to pass your key id and application key tothe driver constructor as shown below.

To access the credentials, you can login tohttps://secure.backblaze.com/user_signin.htm, then click “App Keys” or goto https://secure.backblaze.com/app_keys.htm directly.

keyID serves as the first and applicationKey as the second argument tothe driver constructor.

API Docs¶

class libcloud.storage.drivers.backblaze_b2.BackblazeB2StorageDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]

Object Storage Companies

Parameters:
  • key (str) – API key or username to be used (required)
  • secret (str) – Secret password to be used (required)
  • secure (bool) – Whether to use HTTPS or HTTP. Note: Some providersonly support HTTPS, and it is on by default.
  • host (str) – Override hostname used for connections.
  • port (int) – Override port used for connections.
  • api_version (str) – Optional API version. Only used by driverswhich support multiple API versions.
  • region (str) – Optional driver region. Only used by drivers whichsupport multiple regions.
Return type:

None

Backblaze Object Storage
connectionCls

alias of BackblazeB2Connection

create_container(container_name, ex_type='allPrivate')[source]

Create a new container.

Parameters:container_name (str) – Container name.
Returns:Container instance on success.
Return type:libcloud.storage.base.Container
delete_container(container)[source]

Delete a container.

Parameters:container (libcloud.storage.base.Container) – Container instance
Returns:True on success, False otherwise.
Return type:bool
delete_object(obj)[source]
Object

Delete an object.

Parameters:obj (libcloud.storage.base.Object) – Object instance.
Returns:bool True on success.
Return type:bool
download_object(obj, destination_path, overwrite_existing=False, delete_on_failure=True)[source]

Download an object to the specified destination path.

Parameters:
  • obj (libcloud.storage.base.Object) – Object instance.
  • destination_path (str) – Full path to a file or a directory where theincoming file will be saved.
  • overwrite_existing (bool) – True to overwrite an existing file,defaults to False.
  • delete_on_failure (bool) – True to delete a partially downloaded file ifthe download was not successful (hashmismatch / file size).
Returns:

True if an object has been successfully downloaded, Falseotherwise.

Return type:

bool

download_object_as_stream(obj, chunk_size=None)[source]

Return a iterator which yields object data.

Parameters:
  • obj (libcloud.storage.base.Object) – Object instance
  • chunk_size (int) – Optional chunk size (in bytes).
Return type:

iterator of bytes

download_object_range(obj, destination_path, start_bytes, end_bytes=None, overwrite_existing=False, delete_on_failure=True)

Download part of an object.

Parameters:
  • obj (libcloud.storage.base.Object) – Object instance.
  • destination_path (str) – Full path to a file or a directory where theincoming file will be saved.
  • start_bytes (int) – Start byte offset (inclusive) for the rangedownload. Offset is 0 index based so the firstbyte in file file is “0”.
  • end_bytes (int) – End byte offset (non-inclusive) for the rangedownload. If not provided, it will default to theend of the file.
  • overwrite_existing (bool) – True to overwrite an existing file,defaults to False.
  • delete_on_failure (bool) – True to delete a partially downloaded file ifthe download was not successful (hashmismatch / file size).
Returns:

True if an object has been successfully downloaded, Falseotherwise.

Return type:

bool

download_object_range_as_stream(obj, start_bytes, end_bytes=None, chunk_size=None)

Return a iterator which yields range / part of the object data.

Parameters:
  • obj (libcloud.storage.base.Object) – Object instance
  • start_bytes (int) – Start byte offset (inclusive) for the rangedownload. Offset is 0 index based so the firstbyte in file file is “0”.
  • end_bytes (int) – End byte offset (non-inclusive) for the rangedownload. If not provided, it will default to theend of the file.
  • chunk_size (int) – Optional chunk size (in bytes).
Return type:

iterator of bytes

enable_container_cdn(container)

Enable container CDN.

Backblaze Storage Pod 5.0

Parameters:container (libcloud.storage.base.Container) – Container instance
Return type:bool
enable_object_cdn(obj)

Enable object CDN.

Parameters:obj (libcloud.storage.base.Object) – Object instance
Return type:bool
ex_get_upload_data(container_id)[source]

Retrieve information used for uploading files (upload url, auth token,etc).

Rype:dict
ex_get_upload_url(container_id)[source]

Retrieve URL used for file uploads.

Return type:str
get_container(container_name)[source]

Return a container instance.

Parameters:container_name (str) – Container name.
Returns:Container instance.
Return type:libcloud.storage.base.Container
get_container_cdn_url(container)

Return a container CDN URL.

Parameters:container (libcloud.storage.base.Container) – Container instance
Returns:A CDN URL for this container.
Return type:str
get_object(container_name, object_name)[source]

Return an object instance.

Parameters:
  • container_name (str) – Container name.
  • object_name (str) – Object name.
Returns:

Object instance.

Return type:

Backblaze Object Storage Solutions

Server
get_object_cdn_url(obj)

Return an object CDN URL.

Parameters:obj (libcloud.storage.base.Object) – Object instance
Returns:A CDN URL for this object.
Return type:str
iterate_container_objects(container, prefix=None, ex_prefix=None)[source]

Return a generator of objects for the given container.

Parameters:
  • container (Container) – Container instance
  • prefix (str) – Filter objects starting with a prefix.Filtering is performed client-side.
  • ex_prefix (str) – (Deprecated.) Filter objects starting with a prefix.Filtering is performed client-side.
Returns:

A generator of Object instances.

Return type:

generator of Object

iterate_containers()[source]

Return a iterator of containers for the given account

Returns:A iterator of Container instances.
Return type:iterator of libcloud.storage.base.Container
list_container_objects(container, prefix=None, ex_prefix=None)

Return a list of objects for the given container.

Parameters:
  • container (libcloud.storage.base.Container) – Container instance.
  • prefix (str) – Filter objects starting with a prefix.
  • ex_prefix (str) – (Deprecated.) Filter objects starting with a prefix.
Returns:

A list of Object instances.

Return type:

list of libcloud.storage.base.Object

Backblaze Object Storage Solutions

Storage
list_containers()

Return a list of containers.

Returns:A list of Container instances.
Return type:list of Container
upload_object(file_path, container, object_name, extra=None, verify_hash=True, headers=None)[source]

Upload an object.

Note: This will override file with a same name if it already exists.

upload_object_via_stream(iterator, container, object_name, extra=None, headers=None)[source]

Upload an object.

Note: Backblaze does not yet support uploading via stream,so this calls upload_object internally requiring the object datato be loaded into memory at once