Skip to main content

Versioning

Bucket versioning is a core S3 feature and it's fully supported by Cubbit. It allows for keeping multiple versions of an object, which protects from unintended overwrites and deletions, providing a safer way to manage your files.

Object locking

Bucket versioning is a requirement to enable object locking.

Safe uploads

When versioning is enabled, uploading the same file with the same name over and over does not overwrite anything, instead, it creates a new version of the object. Each new version has a unique version ID, which consists of 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 very specific version of the object, once you know its version ID.

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

Download specific object versionDownload specific object version

Safe deletes

Moreover, 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. But of course, if you want to permanently remove a specific version, you can still do it by specifying its version ID.

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

Deleting creates a DeleteMarkerDeleting creates a DeleteMarker

Final caveats

There are a few other things that it's worth mentioning.

It's a bucket-level feature

Please keep in mind that versioning can only be enabled on an entire bucket. Thus, it's not possible to enable it on a subset of objects.

More details on how to enable versioning on a bucket can be found here.

Buckets can be suspended

Finally, you can also suspend bucket versioning: this just changes the bucket behavior from this moment, but older versions won't be touched.

Watch out for storage capacity

While versioning a bucket is a great feature and provides a safe way to work with objects, this comes with a cost in terms of storage.

For instance, let's say you are doing a daily backup of a 1 GB file. If you're uploading the file into a versioned bucket, each day you create a new version and increase the used storage by 1 GB. After a month, your object would be made of 30 versions occupying a total of 30 GB.

More details on how to permanently get rid of some versions can be found here.

Usage

The following section explains how to work with this feature, either using the Cubbit Console or the AWS s3api CLI commands.

Enable bucket versioning

Let's start enabling versioning on a whole bucket.

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 and move on to the next step.
  4. When prompted for the bucket versioning, click on the "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!