You are currently viewing Versioning in AWS S3 bucket

Versioning in AWS S3 bucket

Loading

Amazon Web Services (AWS) Simple Storage Service (S3) is a powerful and widely-used storage solution that addresses these needs and more. One of its key features is versioning, a mechanism that allows you to maintain multiple variants of an object within the same bucket. In this blog you will learn about how to do versioning in AWS S3 bucket using AWS management console and using commands.

Steps to perform Versioning in AWS S3 bucket

Log in to the AWS Management Console and navigate to the S3 service.

First of all go to create bucket option and you will see interface like this. There are two types of bucket you will see one is General purpose bucket and the other one is Directory bucket.

You have to select the General purpose bucket and give a name to it. Make sure the name should be unique, and no uppercase letter allowed.

versioning in s3 bucket

After that you will see the option of Object ownership. Here you have to select disabled. But let us understand what is Access Control List (ACL)

  • It is a mechanism which helps you to specify who can access the specific buckets and the objects and what actions they can perform on them.

Next you will se the option of Block public access settings. Here you have to enable it by ticking.

  • This option is preferred when you want to block all the public access (Even if ACL is granted). So the best practice is to enable it.

After that you have to go to bucket versioning section and enable it.

  • Bucket versioning is a feature which whelps you keep multiple variants of an object in the same bucket. With the help of this feature you can retrieved every version of each object.

Next you will see the option of tags. So let us understand what is tags. Tags are in the form of key value pairs which is useful for categorizing resources based on various criteria such as purpose or owner. You can leave this thing as optional also.

Next you will see the option of Default encryption.

  • Bi-default AWS uses Server Side encryption with S3 Managed Keys (SSE-S3). It is simple and easy to use
  • Next we have Server Side encryption with with AWS Key Managed Service Keys (SSE-KMS). It uses keys to encrypt your data.
  • And last we have Dual layer Server Side encryption with with AWS Key Managed Service Keys (DSSE-KMS). Here you add extra layer of security by encrypting your data twice with different KMS keys.
  • Remember that bucket key is bi-default enable.

Last you will see the option of Advance setting. Here you will see object lock. It is used when you prevent the objects from being deleted or overwritten.

  • It only works when versioning is enabled in the AWS S3 bucket.
  • It stores object using WORM model (Write once read many).

Now upload two files one by one with same name and if you enable the show version you can see both the files.

Commands to enable versioning in an AWS S3 bucket

  1. Enable versioning on a bucket:
aws s3api put-bucket-versioning --bucket YOUR_BUCKET_NAME --versioning-configuration Status=Enabled
  1. Check versioning status of a bucket:
aws s3api get-bucket-versioning --bucket YOUR_BUCKET_NAME
  1. Suspend versioning on a bucket:
aws s3api put-bucket-versioning --bucket YOUR_BUCKET_NAME --versioning-configuration Status=Suspended

Once versioning is enabled, every object uploaded to the bucket will have a unique version ID associated with it. Deleting an object will not remove it entirely; instead, it will create a delete marker, preserving the previous versions. You can manage these versions and delete markers using various S3 commands or through the AWS Management Console.

Conclusion

In this blog you will learn about how to enable versioning in AWS S3 bucket.

You can tell your friends or coworkers about this blog if you like it. There are social media sites like LinkedIn, Twitter, and Instagram where you can find me.