Amazon Simple storage service (S3) is an object oriented storage service which provides the features such as data availability data scalability, security, and also used for enhance the performance service provided by Amazon Web Services. S3 also allows you to store as many objects as you’d like with an individual object size limit of five terabytes. With cost-effective storage classes and easy-to-use management features, you can optimize costs, organize data, and configure fine-tuned access controls to meet specific business, organisation, and compliance requirements.
Using Versioning In S3 Buckets
An organization relies on services that give them security, reliability, performance, and data availability. AWS provides an S3 feature which is basically a storage class that gives all such features and also promotes scalability of the organization as well as stores data and protects them. Now let’s understand what is S3 Versioning, in layman’s term suppose in the S3 storage class, someone uploads a picture of ID:113, and suppose after some time he/she updates the picture or replace it with ID:112. Now, suppose that he/she feels that the previous one was better and wants to roll back to picture ID:113. How to get that? The S3 Versioning comes into the picture now.
Pictorial representation of S3-Versioning
It allows storing of different versions or forms of the object. Versioning makes it easier to preserve and roll back old updates of objects, whenever needed. Moreover, it helps to restore back the object from any unintended user activity such as deleting the object unintentionally. To know how to create Amazon S3 – Creating a S3 Bucket.
UnVersioned, Versioning-Enabled And Versioning Suspended Buckets:
S3 bucket available in three states depending on there state of versioning as following.To know about storage classes refer to Amazon S3 – Storage Classes.
- UnVersioned (default)
Un-versioned state is the begining stage of an S3 bucket where all the objects which are stored in the bucket will remain unversioned means. This also called default state where if any updates are done to the objects in the bucket will get replaced by new bucket.
This state is safest state to the object to be in if any updates or modifies happens S3 will store version of that update which means the older versions will remains same and the new version will be stored new unique ID.
If you don’t want any new versions of an object to store in your bucket then you can suspend the bucket versioning. The new objects which are going to store in the bucket will not be versioned and the objects which are versioned will know be lost if you make any modifications.
Using S3 Versioning With S3 Lifecycle
An S3 Lifecycle Management in simple terms when in an S3 bucket some data is stored for a longer time in standard storage even when not needed. The need to shift this old data to cheaper storage or delete it after a span of time gives rise to life cycle management. To Know more about Amazon S3 – Lifecycle Management.
How S3 Versioning Works?
S3 versioning helps you to maintain the different versions of the objects in an single bucket which you can keep an track of the objects like updated version and what the updates are made when compared to the previous objects. following are some of major changes will happen when the bucket is versioned.
If you want to store the updated version of object in the S3 bucket with out overwriting the current version of object stored in S3 bucket then bucket versioning will helps you to store different version by maintaing the previous version .
The owner of th bucket will have all the authority to maintain the permission to the bucket by using AWS identity and access management(IAM).
How to Enable Versioning?
Below mentioned is the Step By Step guide to Enable Versioning:
Step 1: Log in to your Amazon Web Services Account>> In your console search bar, search “S3”>>then select the S3. To create AWS free tier account refer to Amazon Web Services (AWS) – Free Tier Account Set up.
Step 2: Then on the Amazon S3 page click on create a bucket.
Step 3: In create bucket page, Give the bucket a Name
NOTE: name must be unique and should not contain any space or uppercase letter)>>Select any region>>Enable ACL (Access Control List basically helps to manage access to created buckets and it’s a different version of object)>>Un-tick Block all public access option (If you want to give it public access)>>Click on “I acknowledge” >> Enable Bucket Versioning>>Keep default encryption disabled>>Click on Create Bucket
Step 4: Click on your created bucket>>Click on upload>>Upload any file
Step 5: Here I have uploaded a txt file named Text1 (Content of Text1-“This is my text1”)>>Click on the file you uploaded>>Below you will find object URL>>try to hit the link in a browser, you won’t be able to access the content. Now, go to object action>>Click on the public using ACL.
Step 6: In make public page>>Click on Make Public option.
Step 7: Again, click on your uploaded file>>now copy on the object URL present below>>Try to hit on your browser.
After hitting the URL in the browser:
Step 8: Now, go to your bucket where your file is present, make some changes, and upload it again. My updated file content is “This is my updated text1”. Then follow Steps 5,6,7 again. This time you can see your updated version of the file.
Step 9: Now to get the previous content of the file or to roll back-Go to your created bucket>>Click on show version option>>You can find all your previous contents.
Step 10: To get your deleted content- Go to your bucket>>select the file>>click on delete option present on top>>Type delete in delete screen.
Step 11: Go back to the same bucket>>Click on show version
You can find your deleted file with type as “Delete marker”. To recover the deleted object, delete the “Delete marker”.
This rollback of versions of objects is what makes versioning popular.
In above we created bucket with versioning enabled
Disable The Versioning Of S3 Bucket
Below mentioned is the Step By Step guide to Disable Versioning of S3 Bucket:
Step 1: Create or login to your AWS account and then you will land on AWS management console and Go to services and select S3.
Step 2: click on create bucket and A new window will pope up, where you have to enter the details and configure your bucket
Step 3: Configure public access settings for your bucket.
Step 4: Configure Bucket Versioning (let it be disabled as of now) and add Tags to your bucket.Versioning in AWS is used to store the “multiple variant of object ” inside the same bucket
Step 6: Click on Create bucket
AWS S3 Bucket Versioning – FAQ’s
1. Is S3 Versioning Incremental?
S3 versioning isn’t incremental, therefore no. When versioning is enabled for an S3 bucket, every object in the bucket—including the original object and all future modifications—is versioned.
2. Why Does S3 Replication Require Versioning?
Versioning is necessary for S3 replication as it is the only technique to guarantee that every version of an object is copied to the destination bucket.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!