Versioning
- Versioning is a means for keeping multiple variants of the same object in the bucket.
- Versioning is used to preserve, retrieve, and restore every version of every object stored in an S3 bucket.
- Versioning is done at the S3 Bucket level.
- Versioning can be enabled from the AWS Console / SDKs / API.
- Versioning, once enabled, cannot be completely disabled.
- The alternative to disabling versioning is placing the bucket in a “versioning-suspended” state.
- A drawback of having multiple versions of an object is you are billed multiple times (since the objects are getting stored in S3 each time).
- In order to avoid having multiple versions of the same object, S3 has a feature called Lifecycle Management. This allows us to decide on what to do when multiple versions of an object are piling up.
- One advantage of versioning is, we can provide permissions on versioned objects i.e., we can define which version of an object is public and which one is private.
High-Level Architecture Diagram

Step 1. Sign in to AWS Management Console.
Step 2. Create an S3 bucket.




Step 3. Enable versioning on the S3 bucket.



Step 4. Upload an object and make the bucket public.





1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
{ "Id": "Policy1", "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1", "Action": [ "s3:GetObject" ], "Effect": "Allow", "Resource": "replace-this-string-from-your-bucket-arn/*", "Principal": "*" } ] } |



Step 5. Upload different versions of the file.



Step 6. Test the versioning of the object.
