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:
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
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>
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
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 email@example.com