Skip to main content

Versioning

With versioning on, Object Storage keeps every version of an object. When a file is overwritten or deleted, the earlier version stays in the bucket and you can bring it back. Turn it on for any bucket that holds data you can't easily recreate, such as backups and documents.

Versioning is also required for Object Lock and cross-region replication.

:::info API only The web panel has no versioning switch. Use aws-cli or another S3 tool. See Using the S3 API for setup. :::

Turn versioning on​

cd ~
aws s3api put-bucket-versioning --bucket <bucket> \
--versioning-configuration Status=Enabled --profile bamboozle

Check the status:

cd ~
aws s3api get-bucket-versioning --bucket <bucket> --profile bamboozle

Versioning only protects objects written after you turn it on.

Suspend versioning​

cd ~
aws s3api put-bucket-versioning --bucket <bucket> \
--versioning-configuration Status=Suspended --profile bamboozle

Once versioning has been on, a bucket can't go back to "never versioned". Suspending stops new versions being kept, but existing versions stay until you delete them.

How deletes work with versioning​

  • Deleting an object without a version ID doesn't remove any data. It adds a delete marker, which becomes the latest version. The object disappears from normal listings, but all its versions are still there.
  • Deleting a specific version (with its version ID) removes that version permanently.
  • Removing the delete marker brings the object back.

List versions​

cd ~
aws s3api list-object-versions --bucket <bucket> --prefix reports/q3.xlsx --profile bamboozle

The output has two lists: Versions (each with a VersionId and IsLatest) and DeleteMarkers.

Restore an earlier version​

Undo a delete: remove the delete marker.

cd ~
aws s3api delete-object --bucket <bucket> --key reports/q3.xlsx \
--version-id <delete-marker-version-id> --profile bamboozle

Undo an overwrite: copy the old version over the current one. This creates a new latest version with the old content.

cd ~
aws s3api copy-object --bucket <bucket> --key reports/q3.xlsx \
--copy-source "<bucket>/reports/q3.xlsx?versionId=<version-id>" --profile bamboozle

Just download an old version:

cd ~
aws s3api get-object --bucket <bucket> --key reports/q3.xlsx \
--version-id <version-id> q3-old.xlsx --profile bamboozle

With rclone, rclone ls --s3-versions bamboozle:<bucket> lists old versions, and --s3-version-at "2026-10-01 12:00:00" shows the bucket as it was at that time.

Delete a version permanently​

cd ~
aws s3api delete-object --bucket <bucket> --key reports/q3.xlsx \
--version-id <version-id> --profile bamboozle

To stop other users doing this, deny s3:DeleteObjectVersion in a bucket policy. To stop everyone, including you, use Object Lock.

Cost​

Every version is billed as stored data. A 1 GB file overwritten every day for 30 days uses about 30 GB. Add a lifecycle rule to delete old versions automatically after a set number of days.

Was this page helpful?