How to Check if Versioning is Enabled on an S3 Bucket

How to Check if Versioning is Enabled on an S3 Bucket
Sharing is Caring:

Dear Reader, Today’s post is a beginner friendly guide on “How to Check if Versioning is Enabled on an S3 Bucket“.

I see this question posted in online forums quite frequently, specially about checking versioning status of a bucket using AWS CLI.

I will show you, how you can check versioning status using AWS console as well as CLI. Stay tuned with me to know more.

Suggested Read:

Alright, let’s start with AWS console and we will move to CLI later.

Check Versioning Status Using AWS Console

In this section, you will learn to check versioning status of an S3 bucket in a step by step manner.

Step 1: Login to AWS Management Console and open S3

Login to AWS Management Console and open S3 service.

You can either go to Services -> Storage -> S3

or

Type s3 in the search bar and hit enter. Once you see S3 option click on that.

How to Create an S3 Bucket 2

Step 2: Choose the bucket on which you want to enable versioning

Once you click on S3, you will see the list of your buckets in your account.

I have these buckets in my account, let’s check the versioing status of cloud-katha-demo-bucket bucket.

How to Check if Versioning is Enabled on an S3 Bucket 1

Click on your bucket name for which you want to check if versioning is enabled or not.

Step 3: Go to Properties tab

Versioing disabled

As you can see Bucket Versioning is Disabled which is default as well. If you want to enable versioning you can do that explicitly. After enabling versioning you will see status as Enabled.

Check versioning Status of bucket using AWS CLI

Checking versioning status of a bucket is really simple and quick to check

aws s3api get-bucket-versioning --bucket cloud-katha-demo-bucket

But there is a catch 😛

As soon as I ran above command,

I was not getting any output. I was confused on weather I was giving command correctly. But it turned out that if you don’t have versioning enabled on your bucket, get-bucket-versioning command will return no output.

As confusing as it may sound, but it’s the harsh reality. I expect AWS to return Disabled and not confuse us for hours if we are doing things right.

But anyway, now you know the catch. 🙂 Thank me later for saving your valuable time 🤪

If the get-bucket-versioning command does not return any CLI output, the S3 Versioning feature is not enabled

I confirmed the command validity by enabling bucket versioning on the bucket and then firing the command again.

aws s3api get-bucket-versioning --bucket cloud-katha-demo-bucket

And voila, I got the response as below.

{
    "Status": "Enabled"
}

That’s a good progress!!!

For experimentation purpose, I suspended versioning on the bucket and ran get-bucket-versioning command again.

To my surprise this time I got response as Suspended. So looks like AWS doesn’t love Disabled status of bucket versioning.

Come on AWS, show some love to versioning disabled bucket.

versioing status enabled and disan=bled

Conclusion

In this quick article, we learnt “How to Check if Versioning is Enabled on an S3 Bucket”. We checked versioning status of an S3 bucket using AWS Console as well as CLI.

Additionally, we also learnt that while using CLI to check versioning you will not get any output when versioning is disabled. However, when versioning is Enabled/Suspended you will see response like below.

{
    "Status": "Enabled/Suspended"
}

I hope I was able to explain the quirks of checking bucket versioning specially when using CLI. Feel free to reach out to me in comment section if you have any doubt.

Enjoyed the content?

Subscribe to our newsletter below to get awesome AWS learning materials delivered straight to your inbox.

I hope you enjoyed this tutorial. If you have a question, feel free to drop in comment. I will be more then happy to answer your query.

Meanwhile you can also –

Suggested Read:

Sharing is Caring:

Leave a Reply

Your email address will not be published. Required fields are marked *