How to set up cross-region replication in S3?

To set up cross-region replication in S3, follow these steps:

  1. Enable versioning on both the source and destination buckets that you want to replicate data between.

  2. Create a new bucket policy for the destination bucket to allow access from the source bucket. This policy should include permissions for s3:GetReplicationConfiguration, s3:GetObject, and s3:ListBucket.

  3. Enable replication on the source bucket by selecting the source bucket in the S3 console, clicking on the Management tab, and then selecting "Replication" from the options available. Follow the prompts to set up cross-region replication.

  4. Configure the replication options, including the destination bucket, the storage class for replicated objects, and any prefix filters to limit which objects are replicated.

  5. Review and save the replication configuration, making sure to enable the replication rules.

  6. Test the replication by uploading a test file to the source bucket and verifying that it is replicated to the destination bucket in the specified region.

  7. Monitor the replication process using CloudWatch metrics and S3 replication metrics to track the progress and status of your replication configuration.

By following these steps, you can set up cross-region replication in S3 to automatically replicate data from one region to another for backup, disaster recovery, or other purposes.