Does Object Storage Support Versioning?

Does Object Storage support versioning?

With S3 compatible Object Storage you can use versioning which enables you to keep multiple versions of an object so that if you upload a object/file with the same name the S3 Object Storage system will store a version from the previous contents. 


This version will be also stored in the bucket and will not be directly visible.


Please keep in mind that this feature is not enabled for a specific file but for an entire bucket.


How do I enable versioning for my Object Storage?

In order to enable Bucket Versioning please execute the following:

aws --profile eu2 --region default --endpoint-url https://eu2.contabostorage.com s3api put-bucket-versioning --bucket bucket-with-versioning --versioning-configuration Status=Enabled

How do I check that versioning is switched on for my Object Storage?

To check if versioning is switch on for your Object Storage run the following:


aws --profile eu2 --region default --endpoint-url https://eu2.contabostorage.com s3api get-bucket-versioning --bucket bucket-with-versioning

If the result is empty, then versioning is disabled.


How do I list all my versioned objects?


To find all the versioned objects run the following:


aws --profile eu2 --region default --endpoint-url https://eu2.contabostorage.com s3api list-object-versions --bucket bucket-with-versioning

How do I find the versions of a specific object?

If you want to find the versions of a specific object follow the example below. In the example we are looking for the versions of image003.png:


aws --profile eu2 --region default --endpoint-url https://eu2.contabostorage.com s3api list-object-versions --bucket bucket-with-versioning --prefix image003.png

The current version which is also returned in regular file listings is the one where "IsLatest" is true. 


How do find a specific version of an object?

In order to access an older version of a file please use the VersionId from the output above from the request used above. Below you can see an example where we're using image003.png which was used in the example above:


aws --profile eu2 --region default --endpoint-url https://eu2.contabostorage.com s3api get-object --bucket bucket-with-versioning --version-id 'L-6oXdYnuAF1orfDEAHV3mDIliEoB9.' --key image003.png image003.png

How do I disable bucket versioning? 

To disable or suspend the Bucket Versioning please proceed as follows:


aws --profile eu2 --region default --endpoint-url https://eu2.contabostorage.com s3api put-bucket-versioning --bucket bucket-with-versioning --versioning-configuration Status=Suspended

Please note that old versions won't be deleted if you turn off Bucket Versioning. No new versions will be created, that's all.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

Modified on 25 Mar 2024

Can’t find what you’re looking for?

Get in Touch

Do you have a pre-sales question?