#!/bin/sh # Create buckets with versioning and object locking enabled. mc mb -l source/bucket mc mb -l dest/bucket #### Create a replication admin on source alias # create a replication admin user : repladmin mc admin user add source repladmin repladmin123 # create a replication policy for repladmin cat > repladmin-policy-source.json < replpolicy.json < dest/bucket remote_arn=$(mc admin bucket remote add repladminAlias/bucket http://repluser:repluser123@localhost:9000/bucket --service replication --json | jq -r ".RemoteARN") echo "Now, use this ARN to add replication rules using 'mc replicate add' command" # use arn returned by above command to create a replication policy on the source/bucket with `mc replicate add` mc replicate add source/bucket --priority 1 --remote-bucket "${remote_arn}" \ --replicate existing-objects,delete,delete-marker,replica-metadata-sync