Introduction
Have you ever accidentally overwritten or deleted a file in AWS S3? Don't worry - there's a simple feature to save you: S3 Versioning.
In this quick tutorial, I'll show you how to enable versioning on a bucket, test it by uploading multiple versions of the same file, and view or restore previous versions - all for free.
Prerequisites
An AWS account (Free Tier)
A test file (e.g., test.txt)
Step-by-Step
- Create an S3 Bucket Go to the Amazon S3 console
Click "Create bucket
Click "Create bucket"
Choose a unique name (e.g., my-versioning-demo-bucket)
Leave all other settings as default
Click "Create bucket
- Enable Versioning Open your newly created bucket
Go to the Properties tab
Scroll down to Bucket Versioning
Upload a File
Go to the Objects tab
Click UploadWhat You Get
You've now enabled automatic version tracking for your S3 bucket.
Each time you upload a file with the same name, S3 silently keeps the old version - no backup scripts needed.
Why Use S3 Versioning?
🔁 Restore files deleted or overwritten by mistake
🕓 Roll back to a known good version
🧪 Test changes without fear of data loss
Conclusion
S3 Versioning is a hidden gem that acts like a built-in time machine for your files. Whether you're building apps or hosting a static website, it's a simple and powerful way to stay safe.
Top comments (1)
Feel free to ask questions Whenever you want.