How to use bucket versioning
Versioning is a feature designed to keep multiple variants of an object in the same bucket. When enabled, it allows you to store, retrieve, and restore every version of your objects stored in a bucket.
Versioning allows you to easily recover your objects in case of unintended user actions or application failures.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged in to the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
Versioning overview
General concepts
- Version ID: a unique identifier generated for each object write. Combined with the object key, it forms the full object address. Without versioning, the key alone identifies the object.
- Current version: the most recent write. The console object list and any
GETrequest without a version ID return this version by default. - Non-current (previous) version: any older write. Non-current versions remain stored, are billable, and can be retrieved by version ID.
- Delete marker: a placeholder current version that a
DELETEoperation inserts on a versioned bucket. The object appears removed, but prior versions remain intact. Removing the delete marker restores the object. nullversion: an object written before versioning was enabled, or while versioning is suspended. It has no version ID, and only onenullversion exists per key.- Versioning states: a bucket is
Unversioned(versioning never enabled),Enabled, orSuspended. Once enabled, versioning cannot return to theUnversionedstate, only toSuspended.
Object and bucket behavior
An object version behaves like a regular object, except that a combination of the object key and a version ID identifies it, rather than the key alone.
Buckets with versioning enabled observe the following behavior:
| Situation | What happens to existing objects | What happens to new objects |
|---|---|---|
| Versioning never enabled | Every object uploaded has a single null version. | Overwrites permanently replace the previous object, and deletes remove it completely. |
| Versioning enabled from the start | Every object uploaded receives a unique version ID. | Each subsequent write creates a new version automatically. |
| Versioning disabled initially, then enabled | Objects uploaded before the switch remain as a null version and are not versioned. | New objects are versioned, and overwrites create new versions. |
| Versioning enabled, then suspended | Existing versions stay exactly as they are, and are not removed automatically. | New objects do not get a version ID. Overwrites replace the current null version, but older versions remain in place. |
| Versioning enabled, then bucket deleted | All versions are deleted together when the bucket is removed. | N/A |
How to enable versioning
This procedure explains how to enable versioning on an existing bucket. To create a new bucket with versioning enabled, refer to the bucket creation documentation.
- Click Object Storage in the Storage section of the side menu. A list of your buckets displays.
- Click the name of the bucket in which you want to enable versioning.
- Click the Bucket settings tab.
- Scroll down and click the toggle toggle icon under Bucket versioning. A pop-up appears.
- Type ENABLE to confirm your action, then click Enable bucket versioning to proceed.
Once versioning is enabled, uploading an object with the same name as an existing object creates a new version of it. This new version consumes storage as well, which may lead to higher costs.
How to manage object versions
View object versions
-
Click Object Storage in the Storage section of the side menu. A list of your buckets displays.
-
Click the name of your versioned bucket. A list of the objects it contains appears.
-
Click more icon next to the object you want to manage, then click Versioning. A side-panel displays, containing the different versions of your object.
Each object version displays the following elements:
- A unique version ID
- A status badge (CURRENT, PREVIOUS, or DELETE MARKER)
- The date of last modification
- The size of the version
- The storage class
- The object lock indicator
Add a new object version
To add a new object version, upload an object with the same key as an existing one.
Restore an object to a previous version
The Scaleway console does not currently provide a native restore action. To restore an object to a previous version, download the desired non-current version and upload it again. This action replaces the current version with the uploaded one.
How to delete an object or a version
When versioning is enabled, deleting an object inserts a delete marker as the current version rather than removing the object. You can also permanently delete a specific version of an object.
Insert a delete marker
- Click Object Storage in the Storage section of the side menu. A list of your buckets displays.
- Click the name of your versioned bucket. A list of the objects it contains appears.
- Click more icon next to the object you want to manage, then click Versioning. A side-panel displays, containing the different versions of your object.
- Click Mark as deleted at the bottom of the side panel. A delete marker is inserted as the current version of your object.
Objects with a delete marker as their current version do not appear in console listings, and return errors when called via the API or CLI tools. Previous versions persist and remain billable.
Delete a specific version
- Click Object Storage in the Storage section of the side menu. A list of your buckets displays.
- Click the name of your versioned bucket. A list of the objects it contains appears.
- Click more icon next to the object you want to manage, then click Versioning. A side-panel displays, containing the different versions of your object.
- Click more icon next to the version you want to delete, then click Delete. A confirmation pop-up appears.
- Confirm the deletion to permanently remove the selected version.
Restore an object by removing its delete marker
- Click Object Storage in the Storage section of the side menu. A list of your buckets displays.
- Click the name of your versioned bucket. A list of the objects it contains appears.
- Use the search bar to locate the object you want to restore.
- Click more icon next to the object name, then click Versioning. A side-panel displays, containing the different versions of your object.
- Delete the delete marker at the top of the versions list.
The version that preceded the delete marker becomes the current version of your object.
How to suspend versioning
Once you enable versioning on a bucket, you can only suspend it rather than disable it completely. When versioning is suspended, existing object versions persist and remain billable.
- Click Object Storage in the Storage section of the side menu. A list of your buckets displays.
- Click the name of your selected bucket.
- Click the Bucket settings tab.
- Scroll down and click the toggle toggle icon under Bucket versioning. A pop-up appears.
- Type SUSPEND to confirm your action, then click Suspend bucket versioning to proceed.
How to use versioning in combination with lifecycle rules
Lifecycle rules can target non-current versions and delete markers to automatically expire or transition them, which is the main lever to control storage costs on a versioned bucket. Refer to the lifecycle rules documentation for more information.