Summary
The object services on both the source and destination regions have to be allowed to manage objects in the tenancy. The oci os replication create-replication-policy
command is used to establish replication. Only objects created after establishment are replicated.
Reference
Create Replication Policy
The object services at both the primary and replicated region have to allowed to manage objects in the tenancy in order for replication to work. Use the following commands to create such a policy for Sydney and Melbourne:
printf -v policy '["%s","%s"]' \ "Allow service objectstorage-ap-sydney-1 to manage object-family in tenancy" \ "Allow service objectstorage-ap-melbourne-1 to manage object-family in tenancy" oci iam policy create \ --compartment-id ${OCI_CLI_TENANCY} \ --name 'object-storage-service' \ --statements "${policy}" \ --description 'Allow Object Storage Service to manage objects in my tenancy'
Create Destination Bucket
Use the oci os bucket create
command to create the buckets in both regions.
Create Replication Policy
On the source region (e.g. Sydney), use the following commands to create the replication policy:
oci os replication create-replication-policy \ --bucket-name ${source_bucket_name} \ --name "Replication from Sydney to Melbourne" \ --destination-region ap-melbourne-1 \ --destination-bucket ${destination_bucket_name}
Note: Objects uploaded to the source bucket after policy creation are asynchronously replicated to the destination bucket.