Amazon S3 Versioning is a feature that allows multiple versions of an object to exist within a bucket. This is useful for recovering overwritten files, restoring deleted objects, and tracking changes. In this guide, we'll explore how to enable versioning, update files, restore previous versions, and manage delete markers.


1. Enabling S3 Versioning

To enable versioning on an S3 bucket:

  1. Open the S3 Console.
  2. Navigate to your S3 bucket.
  3. Go to the Properties tab.
  4. Scroll down to Bucket versioning.
  5. Click EditEnable versioning.
  6. Click Save.

Effect: Once enabled, any file that is overwritten or deleted will retain previous versions instead of being permanently removed.


2. Uploading and Updating Files with Versioning

Now that versioning is enabled, let's upload and modify files.

  1. Upload index.html (or any file) to your bucket.
  2. Open your website URL in a browser to confirm the content.
  3. Modify index.html locally (e.g., change "I love coffee""I REALLY love coffee").
  4. Re-upload the updated index.html to the S3 bucket.

🚀 Outcome: