How to Set Up Cloud Replication with the Backblaze B2 Command-Line Tool
- Print
- DarkLight
How to Set Up Cloud Replication with the Backblaze B2 Command-Line Tool
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
If you have access to accounts that host both a source bucket and a destination bucket (it can be the same account), you can set up Cloud Replication using the command-line interface (CLI).
Manual Setup
Follow these steps to manually set up Cloud Replication.
Set Up a Destination Key
$ b2 key create --profile myprofile2 my-bucket-rpldst writeFiles,writeFileLegalHolds,writeFileRetentions,deleteFiles
0024ab2345678900000000234 K001YYABCDE12345678901234567890Create a B2 CLI Profile for Destination Account
b2 account authorize --profile destSet Up a Source Key
$ b2 key create my-bucket-rplsrc readFiles,readFileLegalHolds,readFileRetentions
0014ab1234567890000000123 K001ZA12345678901234567890ABCDESet Up Destination Replication
$ b2 bucket update --profile myprofile2 --replication '{
"asReplicationDestination": {
"sourceToDestinationKeyMapping": {
"0014ab1234567890000000123": "0024ab2345678900000000234"
}
}
}' my-bucketSet Up Source Replication
$ b2 bucket update --replication '{
"asReplicationSource": {
"replicationRules": [
{
"destinationBucketId": "85644d98debc657d880b0e1e",
"fileNamePrefix": "files-to-share/",
"includeExistingFiles": false,
"isEnabled": true,
"priority": 128,
"replicationRuleName": "my-replication-rule-name"
}
],
"sourceApplicationKeyId": "0014ab1234567890000000123"
}
}' my-bucketWas this article helpful?