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
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-3-1024x433.png)
Step 1. Sign in to AWS Management Console.
Step 2. Create an S3 bucket.
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-4.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-5.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-6.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-7-1024x207.png)
Step 3. Enable versioning on the S3 bucket.
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-8-1024x265.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-9-1024x289.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-10.png)
Step 4. Upload an object and make the bucket public.
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-11-1024x407.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-12.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-13.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-14-1024x312.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-15-1024x432.png)
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": "*" } ] } |
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-16-1024x532.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-17-1024x341.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-18.png)
Step 5. Upload different versions of the file.
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-20.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-19-1024x362.png)
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-21.png)
Step 6. Test the versioning of the object.
![](https://www.coddicted.com/wp-content/uploads/2023/07/image-22-1024x298.png)