Docs

Versioning

With versioning on, chili keeps every version of an object. When an object is overwritten, the previous version is kept as a noncurrent version. When it is deleted, chili sets a delete marker and the data is kept as well. This lets you recover files that were overwritten or deleted by mistake.

In the chili Console the setting is called Versioning. It is billed per TB and month. See pricing for terms.

What versioning is for

  • Accidental overwrites: an application writes a broken file over a good one. The good version is still there as a noncurrent version.
  • Accidental deletes: a script deletes too much. The objects are hidden behind a delete marker and can be restored.
  • Basis for Object Lock: Object Lock locks individual object versions. Without versioning there is nothing to lock.

Versioning alone does not protect against an attacker holding valid access keys: anyone allowed to delete versions can delete noncurrent versions too. For backups that must withstand ransomware, combine versioning with Object Lock.

How it works

Action

Without versioning

With versioning

Upload an object

object is stored

new version with its own version ID

Overwrite an object

old data is gone

previous version is kept as a noncurrent version

Delete an object (no version ID)

object is gone

chili sets a delete marker, all versions are kept

Delete a specific version (with version ID)

not possible

exactly this version is deleted permanently

Normal listings and downloads always show the current version. If a delete marker is on top, the object no longer appears in listings and a download without a version ID returns NoSuchKey. You only see noncurrent versions when you ask for versions explicitly.

Costs and storage use

Every noncurrent version takes up storage like a separate object. A bucket where files are overwritten often grows much faster with versioning than without. On top of that comes the price of the versioning add-on per TB and month.

To stop the data from growing without limit, delete noncurrent versions automatically after a fixed period with a lifecycle rule (NoncurrentVersionExpiration). Versions locked with Object Lock are removed by a lifecycle rule only after their period ends.

Turning it on and off

  • At creation: in the wizard of the chili Console, select Versioning in the Bucket step. The templates "rclone or scripts" and "Manage files" already turn versioning on.
  • Later: if you did not choose versioning at creation, turn it on in the bucket details in the Console.
  • With Object Lock: versioning is always on and cannot be turned off.

Under the S3 standard, versioning cannot be removed completely once it has been turned on; it can only be suspended (Suspended). While suspended, chili no longer creates additional versions for new writes. Existing versions stay stored until you delete them.

Restoring an object

There are two ways to get an earlier version back:

  1. Remove the delete marker: if an object was deleted, delete the delete marker by its version ID. The latest version becomes current again.
  2. Copy a noncurrent version: if an object was overwritten, copy the version you want onto the same key. The copy becomes the new current version; the other versions are kept.

Many tools also show noncurrent versions in their interface, for example Cyberduck. Restores are free on chili because there are no egress fees.

With the AWS CLI

The examples use the default endpoint. For buckets with geo-redundancy, use https://s3-ch.chilistorage.com.

Check the status:

aws s3api get-bucket-versioning \
  --bucket my-bucket \
  --endpoint-url https://s3-ch-east.chilistorage.com

The response contains "Status": "Enabled" or "Status": "Suspended". An empty response means versioning was never turned on.

Turn versioning on or suspend it (we recommend turning it on in the Console):

aws s3api put-bucket-versioning \
  --bucket my-bucket \
  --versioning-configuration Status=Enabled \
  --endpoint-url https://s3-ch-east.chilistorage.com

aws s3api put-bucket-versioning \
  --bucket my-bucket \
  --versioning-configuration Status=Suspended \
  --endpoint-url https://s3-ch-east.chilistorage.com

List the versions and delete markers of an object:

aws s3api list-object-versions \
  --bucket my-bucket \
  --prefix reports/revenue.xlsx \
  --endpoint-url https://s3-ch-east.chilistorage.com

Versions lists the versions with VersionId, LastModified and IsLatest; DeleteMarkers lists the delete markers.

Restore a deleted object by removing the delete marker:

aws s3api delete-object \
  --bucket my-bucket \
  --key reports/revenue.xlsx \
  --version-id <DELETE_MARKER_VERSION_ID> \
  --endpoint-url https://s3-ch-east.chilistorage.com

Make a noncurrent version current again:

aws s3api copy-object \
  --bucket my-bucket \
  --key reports/revenue.xlsx \
  --copy-source "my-bucket/reports/revenue.xlsx?versionId=<VERSION_ID>" \
  --endpoint-url https://s3-ch-east.chilistorage.com

Download a specific version without changing anything:

aws s3api get-object \
  --bucket my-bucket \
  --key reports/revenue.xlsx \
  --version-id <VERSION_ID> \
  revenue-old.xlsx \
  --endpoint-url https://s3-ch-east.chilistorage.com

Common pitfalls

  • Bucket grows unexpectedly: noncurrent versions count towards used storage. Add a lifecycle rule for noncurrent versions.
  • Object missing from listings, storage still used: a delete marker hides the object. Check with list-object-versions.
  • Deleting with a version ID is permanent: deleting a specific version removes it for good. Give applications only the permissions they need, see Access control.
  • Suspending does not reduce existing data: existing versions stay stored and billed until you delete them.

Next