Setting Up Amazon S3 Replication Rules
Open the AWS Management Console and navigate to the S3 dashboard.
Click Create bucket.
Select General purpose bucket type.
Write a bucket name, this name must be globally unique.
Select ACLs enabled Object Ownership.
Uncheck Block all public access -> Check the Acknowledgement.
Enable Bucket Versioning.
Click Create bucket.
Create one more bucket with the same configuration.
One bucket will act as the source and the other as the destination bucket.
Open any bucket by clicking on its name. This bucket will act as a source bucket.
Click on Management.
Click Create replication rule.
Enter a suitable replication name.
Scroll and choose Apply to all objects in the bucket under Choose a rule scope.
Click Browse S3.
Choose the destination bucket.
Click Choose path.
Select Create new role under IAM role.
Click Save.
Select any under Replicate existing objects? objects click Submit.
Open the source bucket and upload a file.
Open the destination bucket, and you'll find the uploaded file there as well.
Go to the source bucket.
Select the bucket -> Copy URL -> Paste the URL in the other browser tab. You'll not be able to access the file. Try the same in the destination bucket too, you'll get the same result.
In the source bucket, Select the object, click on Action -> Make public using ACL -> Make public.
Now access the bucket. Select the bucket -> Copy URL -> Paste the URL in other browser tab, you'll see the contents of the file.
Navigate to the destination bucket, you'll be able to access the file there too.
Now, permanently delete the file in the source bucket.
Note: Make sure Show versions is enabled when you delete; otherwise, the file will not be permanently deleted.
Now to go destination bucket, you'll see the file in the destination bucket is not deleted.
To delete the replication rule, open the source bucket, click Management, select the replication rule you want to delete under Replication rules, then click Delete and confirm by clicking Delete replication rule.
Subscribe to my newsletter
Read articles from Arish Ahmad directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Arish Ahmad
Arish Ahmad
Final-year BTech student specializing in software development. Completed a Flutter internship and amassed three years of project experience, crafting Threads clone, Stream Arbiter, Ticketify, and Google Docs. Proficient in C++, having successfully solved 250+ LeetCode questions.