Oracle Cloud Object Storage is a regional service, i.e., objects are stored in a specific Oracle Cloud region. You can enable cross-region replication to automatically sync your data to a remote region for redundancy, providing protection from a regional outage.
This blog post describes how to configure cross-region replication, use the replicated Object Storage bucket for read/write after a disaster, and switch back to the original configuration after the source region is available again.
If you are looking for a disaster recovery solution for your entire stack including infrastructure, middleware, database, and application, then have a look at the Full Stack Disaster Recovery service, instead of managing the recovery of each component manually. To set up disaster recovery for Object Storage with Full Stack DR, have a look at the OCI function provided via GitHub.
- Standard Object Storage bucket BucketFrankfurt in the Frankfurt region.
- Standard Object Storage bucket BucketLondon in the London region.
Both buckets are empty and have Object Provisioning disabled. The starting configuration will use Frankfurt as the source region and London as the target region.
Step 1: Configure IAM Policies
Set up the required Identity and Access Management (IAM) policies to allow the Object Storage Service in the corresponding regions to replicate objects on your behalf:
Allow service objectstorage-eu-frankfurt-1 to manage object-family in compartment spetrus Allow service objectstorage-uk-london-1 to manage object-family in compartment spetrus
Step 2: Enable Cross-Region Replication
From the BucketFrankfurt details page, click on Replication Policy, then on Create Policy:
Enter a name, select the target region and bucket, and create the policy:
- Existing objects uploaded to a source bucket before policy creation will not be replicated.
- If the target bucket is not empty and you create a file with the same name on the source bucket after policy creation, the file in the target bucket will be overwritten.
On the source bucket, the policy is now active and you cannot create any further replication policies:
On the target bucket, you will see a banner indicating that this is a target bucket:
You cannot delete the target bucket and you cannot delete, rename, or upload objects to the target bucket.
Step 3: Test the Replication
Upload an object, e.g., file_1.txt, to the source bucket. The file will automatically be replicated to the target bucket.
The objects in the target bucket are read-only.
Step 4: Use the Target Bucket for Read/Write
After a disaster in the source region, you can convert the target bucket to read/write and use it as the primary bucket. From the target bucket details page, click on Replication Policy, then on Stop Replication:
Confirm stopping replication:
Now the target bucket is converted to a standard read/write bucket and you can add objects to it, e.g., file_2.txt.
Step 5: Re-enable Replication
After the source region is available again, you will see the replication policy in status Error. Click on the three dots on the right side and delete the policy:
Now you have two options:
- Continue using the target bucket (BucketLondon) as the primary bucket and create a replication policy from London to Frankfurt.
- Use BucketFrankfurt as the primary bucket again and re-create the replication policy as in step 2.
In both cases, you need to manually replicate all objects that were added to BucketLondon while the replication was stopped. In our example, file_2.txt. You can use OCI CLI in the Cloud Shell in the London region for this purpose:
sinan_petr@cloudshell:~ (uk-london-1)$ oci os object copy --source-object-name file_2.txt --bucket-name BucketLondon --destination-bucket BucketFrankfurt --destination-region eu-frankfurt-1
Object Storage cross-region replication enables you to automatically replicate your data from one region to another for redundancy and disaster recovery. The replicated bucket is available in read-only mode while the replication is active.
In case of a disaster, you can convert the target bucket to read/write by stopping the replication. All objects that were added to the bucket while the replication is stopped need to be copied manually to the former source bucket after the source region becomes available again.
- Documentation: Configure Object Storage cross-region replication for Disaster Recovery
- How to mount an Oracle Object Storage Bucket as File System on Oracle Linux 7
- Ensure Disaster Recovery by replicating Automatic Backups across Regions in Oracle Cloud
- Three Ways to backup your Oracle Cloud Databases to Object Storage
- Import your Data directly from Object Storage in Oracle Database 21.3 and 19.12