AWS S3 replication refers to the ability of this service to store copies of object stored in buckets to other buckets in order to prevent against loss of stored objects. Objects can be copied to Bucket lying in the same AWS region or in different region. You can use either the AWS Management Console, the REST API, the AWS CLI, or the AWS SDKs to enable replication.
- When objects are copied to destination bucket in same region it is called as SRR (Same Region Replication).
- When objects are copied to destination bucket in different region it is called as CRR (Cross Region Replication).
Benefits of using S3 replication:
- You can retain the exact replica of the Object, where even the metadata of the Objects is also retained. Metadata is the data of Object.
- You can replicate the copies of your data to different storage tiers available in S3 for the purpose of the backing up your data while keeping your backup’s cost low.
- Different copies of the object can be kept under different AWS account ownerships.
Cross Region Replication Use Cases:
- CRR lets your store the copies of your data in regions of your choice for HA (High Availability) purpose to meet the enterprises compliance standards. Though AWS S3 service by default stores the data across geographically spread DCs it might fail the enterprise needs for compliance at times.
- CRR helps minimize the latency for users who are trying to access the S3 buckets. You can have copies of Objects in different regions so users close to Region X access Objects stored in Region X while the users close to Region Y access same objects stored in Region Y hence get improved user experience as well.
- Maintain object copies under different ownership. Regardless of who owns the source bucket, you can tell to Amazon S3 to change the ownership to AWS account user that owns the destination bucket. This is referred to as an owner override option.
Related – AWS Cross Region Replication
Same Region Replication Use Cases:
This feature was added to the AWS S3 service recently in Sept 2019, where the users now have the capability of replicating the data in same Region but on a different S3 bucket.
SRR offers HA capability in same Region where all the new files uploaded are automatically replicated at Bucket/Object level.
- You can use SRR where you need to abide to data sovereignty laws which dictate that the data has to be stored locally. In many countries, especially those subject to GDPR, processing and storing sensitive data has to be done locally.
- You can use SRR to create a single log library in one S3 bucket. Developers overseeing large organisations often find themselves storing logs in multiple buckets across multiple accounts, with SSR they can replicate logs into a single, in-region bucket.
Points to Remember for S3 Replication:
- Versioning needs to enable on both the source and the destination bucket.
- If there are any existing files in the source bucket before enabling replication they won’t be automatically replicated, hence will need to be manually backed up at the destination bucket. However any files uploaded to bucket after enabling replication will be automatically backed up to destination bucket.
- Amazon S3 must have permissions to replicate objects from the source bucket to the destination bucket on your behalf.
- If the source bucket has S3 Object Lock enabled, the destination bucket must also have S3 Object Lock enabled
- Delete versions or Delete markers are not replicated.
Related – AWS Interview Questions