S3 Versioning
Now let’s talk about versioning in Amazon S3.
We’ve already seen how to create a website using S3, but it would be nice to be able to update it in a safe way. That’s where versioning comes in.
What Is S3 Versioning?
- You can version your files in Amazon S3.
- This is a setting that must be enabled at the bucket level.
-
Once versioning is enabled:
- Whenever a user uploads a file, it creates a version of that file at the selected key.
-
If you re-upload to the same key, instead of overwriting the file:
- It creates Version 2, then Version 3, and so on.

Why Use Versioning?
-
Protection Against Unintended Deletes
- When you delete a versioned file, it adds a delete marker.
- This allows you to restore previous versions instead of losing data permanently.
-
Easy Rollback
- You can easily roll back to a previous version, for example, to a version from two days ago.
Important Notes
- Any file that was not versioned before versioning was enabled will have the version:
null
. -
If you suspend versioning, it does not delete previous versions.
- Suspending is a safe operation.
Now let’s go into the console and have a look at how we can use versioning….