Skip to main content

Bucket and Object versioning

Intro

Bucket versioning is a feature provided by Amazon Web Services (AWS) that is fully supported by Cubbit DS3. This feature allows you to maintain multiple versions of objects in an S3 bucket, enabling you to preserve, retrieve, and restore every version of an object in your bucket with ease.

Enabling versioning for a bucket assigns a unique version ID to each new version of an object. This ID is automatically generated and cannot be modified or deleted. This feature ensures that you can keep track of all changes made to an object over time and restore a previous version if needed, providing valuable data integrity and disaster recovery benefits.

note

Bucket versioning is a requirement to enable object lock.

Safe uploads

Enabling versioning in your S3 bucket ensures that uploading the same file with the same name multiple times creates a new version of the object instead of overwriting the existing one. Each new version generated has a unique version ID, which is a 128-bit fixed-size UUIDv4.

Upload object on versioned bucketUpload object on versioned bucket

Download a specific version

By default, downloading an object picks its latest version. But you can also retrieve a specific version of the object if you know its version ID.

More information on how to download specific object versions can be found here.

Download specific object versionDownload specific object version

Safe deletes

By default deleting an object does not remove any content, but simply marks the object as deleted with a DeleteMarker on top of it. This means that it's still possible to retrieve or restore any previous version of that object.

If you want to permanently remove a specific version, you can do it by specifying its version ID.

More information on how to delete object versions can be found here.

Deleting creates a DeleteMarkerDeleting creates a DeleteMarker

Caveats

  • Versioning is a bucket-level feature. It can only be enabled for the entire bucket, not for a subset of objects. More information on how to enable versioning on a bucket can be found here.
  • Bucket versioning can be suspended, which changes the bucket behavior going forward without affecting older versions.
  • Keep in mind that versioning comes with a storage cost. For example, if a 1 GB file is backed up daily in a versioned bucket, each backup creates a new version, increasing storage usage by 1 GB. After a month, 30 versions of the object will occupy a total of 30 GB. More information on how to permanently delete versions can be found here.

How to

This section provides instructions for working with the versioning feature using either the Cubbit Web Console or the AWS s3api CLI commands.

Enable bucket versioning

Currently, the only way to enable versioning on a bucket using the Cubbit Console is during its creation.

  1. Sign in with the Cubbit Console.
  2. Click on the "Create bucket" button on the top right.
  3. Choose a bucket name.
  4. In the Versioning section click on the "Versioning enabled" button and finally confirm by clicking on the "Create bucket" button.

Cubbit Console - Create versioned bucketCubbit Console - Create versioned bucket

You should see a brand new bucket, with versioning enabled.

Download specific object versions

You can then list or download specific versions of an object.

Once you've created your versioned bucket, you should:

  1. Click on the versioned bucket you created in the previous step.
  2. Click on the "Show versions" toggle.

Cubbit Console - List versionsCubbit Console - List versions

You can now see all the different versions of a single object and perform operations on a specific file version.

Permanently delete object versions

Finally, let's see how to delete specific object versions. Please keep in mind that versioned delete operations are irreversible.

Given the previous steps, this is pretty straightforward. Once you can list the versions you can also click on a single one, open the menu by clicking on the three dots icon on the right and click on the "Delete" button. This action deletes a single version, permanently.

If, instead, you want to create a DeleteMarker, maintaining the old versions, disable the "Show versions" toggle to get back to the old view. At this point, you can safely delete the object.

tip

Try to click once again on the "Show versions" toggle. Your old versions are still there and a DeleteMarker with size = 0 is on top of them!