قالب وردپرس درنا توس
Home / Tips and Tricks / How to replicate an S3 bucket across regions – CloudSavvy IT

How to replicate an S3 bucket across regions – CloudSavvy IT



S3 logo

If you want to store multiple copies of objects in your S3 buckets in different regions, S3 can be set up to automatically replicate objects from a source bucket to replica buckets around the world, increasing the performance and access latency of your applications increase.

Note that you can use AWS’s CloudFront CDN to cache content in edge locations anywhere if the objects you are replicating are publicly available over the internet, such as B. a media bucket for uploaded content.

How does replication work?

Replication always occurs whenever you upload or update an object in a bucket. You create a replication rule that defines the source and destination areas. Objects uploaded to the source bucket are uploaded to the destination bucket. Versioning must be activated for replication to work. This increases the cost of storage slightly depending on how much data you are overwriting.

There are some limitations. AWS does not replicate deleted objects, so you must delete each copy manually. While replication is usually fairly quick, it can take up to 1

5 minutes or more if you are replicating large objects.

When an object is replicated, a metadata tag is set on the source object. All replicas have the REPLICA Day, and the source object is marked COMPLETED. This means that you can do two-way replication – two buckets with replication rules that reference each other. S3 does not replicate uploaded objects with the replica tag or you will get stuck in an infinite replication loop.

This is known as multi-master replication, but there is no system to ensure that objects uploaded later will be replicated later. In this setup, if you update two objects at the same time, data can become out of sync and it is possible to process stale data while it is being synchronized from one master to the other.

Set up replication

In the S3 Management Console, navigate to the source area. You have to activate the versioning under “Properties:”.

Activate versioning

Once this is enabled, you can add a new replication rule under Administration> Replication> Add Rule.

Add replication rule

By default, all objects are replicated. However, you can set a filter if you want.

Settings for the source bucket

Under Target, select the target area. You can also configure the storage class for the replica objects and set ownership when transferring through accounts. There is also an option for “S3 Replication Time Control”, which guarantees that objects are replicated within 15 minutes, supported by a service level agreement.

    Select the target area

On the next screen, you need to select or create an IAM role for replication. The authorizations are handled automatically. Just enter a name.

Select or create an IAM role for replication

Click on “Next” and then on “Save”. The rule should be active immediately. You can test the upload of an object. It should be replicated to the target area. Then the replication status tag is changed to COMPLETED.


Source link