Configuring the AWS CLI for use with B2

Using B2’s S3 endpoints you are able to use AWS CLI to communicate and update your B2 buckets. Once configured you can use this tool to transfer data between and S3 bucket and B2.


Start by installing AWS CLI. You can do this by following the instructions
here.

Confirm that it is installed by using aws --version.

 

Configuring AWS CLI to interface with your B2 account:

 

Step 1:

Use the command aws configure to start the configuration process.

 

You will be prompted with the following. You can find information highlighted in red by creating keys in the “App Key” section of your Backblaze account.

 

AWS Access Key ID [None]: keyID

AWS Secret Access Key [None]: applicationKey

Default region name [None]: leave blank

Default output format [None]: leave blank

 

Step 2:

Configuration should be set now. You should be able to test the integration by attempting to list buckets on your account.

 

aws s3 ls --endpoint-url=<S3 Endpoint URL>

 

For example:

 

 

Using AWS CLI to transfer data to B2

 

Step 1 (Optional):

If data is coming from an AWS S3 Bucket, you will first need to add your S3 buckets using the configuration tool.

 

Then you will need to copy files to a local directory using the command:

 

aws s3 cp s3://<source_bucket>/ <local_directory> --recursive

 

Step 2:

Now you can transfer files directly to B2 using the command:

 

aws s3 cp <local_directory>/ s3://<destination_bucket>/ --recursive --endpoint-url=<S3 Endpoint URL>

 

 

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 CLI with B2, please let us know by emailing us at b2feedback@backblaze.com

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk