How to use the AWS SDK for Python with B2.

The S3 Compatible API allows developers to interact with B2 Cloud Storage when using the AWS SDK for Python. The endpoint_url simply needs to be pointed to the S3 Endpoint of the Backblaze B2 account you are connecting to, along with supplying an Application Key and Key ID for the account.


Here is an example of doing so and creating a bucket:


import boto3

s3 = boto3.resource('s3',
endpoint_url = '',
aws_access_key_id = '<b2_keyId>',
aws_secret_access_key = '<b2_appKey>')



Backblaze also maintains a Python SDK for the B2 Native API. You can find this project here: 


The S3 Compatible API for Backblaze B2 Cloud Storage allows 1000’s of integrations to work with B2 natively. If you’re new to the S3 Compatible API, please see our Getting Started Guide. If you have any trouble using the AWS SDK for Python with B2, please let us know by emailing us at




Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk