How to Enable Spaces Versioning

Validated on 2 Sep 2025 • Last edited on 5 Sep 2025

Spaces Object Storage is an S3-compatible service for storing and serving large amounts of data. The built-in Spaces CDN minimizes page load times, improves performance, and reduces bandwidth and infrastructure costs.

S3 Versioning maintains previous versions of objects in your buckets, which allows you to restore a previous version of an object if a user or application overwrites or deletes it.

Spaces supports S3 Versioning. By default, versioning is disabled on all buckets. You must use the Spaces API to enable or disable versioning.

Check the Status of Versioning

To check whether versioning is enabled for a bucket, go to the DigitalOcean Control Panel. In the left menu, click Spaces Object Storage, and then click the bucket you want to check to go to its overview page. On the bucket’s overview page, click its Settings tab. The Object Versioning section displays Enabled or Disabled.

Bucket settings page showing the project and disabled object versioning and disabled access logs.

Enable Spaces Versioning

Before you enable Spaces Versioning, you need a DigitalOcean Spaces API key and the endpoint for your bucket.

First, create a DigitalOcean Spaces API key if you don’t already have one. Save the access key ID and the secret key. Use these keys to configure the AWS CLI to access your team.

Next, find the endpoint for your bucket. From the Spaces section of the control panel, click your bucket to open its detail page. Click the Settings tab, and then scroll to the Endpoint section.

Screenshot of 'Endpoint' menu option

The endpoint is always your bucket’s region followed by .digitaloceanspaces.com. Click Copy to copy the endpoint to your clipboard.

Finally, configure the AWS CLI to use your Spaces access key with aws configure.

Then, enable versioning on your bucket using the following command, replacing your_bucket_name with your bucket name and your_endpoint with your endpoint:

aws s3api put-bucket-versioning --bucket your_bucket_name --endpoint=https://your_endpoint --versioning-configuration Status=Enabled

Check whether the command was successful by running:

aws s3api get-bucket-versioning --bucket your_bucket_name --endpoint=https://your_endpoint

If it was successful, it returns:

{
    "Status": "Enabled",
    "MFADelete": "Disabled"
}

Retrieve a Deleted Object in a Versioning-Enabled Bucket

Spaces creates a delete marker when you delete an object from a version-enabled bucket. In this case, the delete marker becomes the current version of the object, and the actual object becomes the previous version.

First, find the deleted object’s delete marker:

aws s3api list-object-versions --prefix your_filename --bucket your_bucket_name --endpoint=https://your_endpoint

This example returns all object versions for files with your_filename in their name:

{
    "Versions": [
        {
            "ETag": "\"3a38169a722a5ac103d758ede3e13be6\"",
            "Size": 701918,
            "StorageClass": "STANDARD",
            "Key": "sammy.png",
            "VersionId": "WT3RrRINHbSmi9o4CUJwtMRMMxg0Wx7",
            "IsLatest": false,
            "LastModified": "2023-04-05T10:00:09.059000+00:00",
            "Owner": {
                "DisplayName": "12148280",
                "ID": "12148280"
            }
        }
    ],
    "DeleteMarkers": [
        {
            "Owner": {
                "DisplayName": "12148280",
                "ID": "12148280"
            },
            "Key": "sammy.png",
            "VersionId": "xod2CHTniex2vcATz0ByCLJzweygEJl",
            "IsLatest": true,
            "LastModified": "2023-04-05T10:01:32.610000+00:00"
        }
    ]
}

Then, remove the delete marker:

aws s3api delete-object --bucket your_bucket_name --endpoint=https://your_endpoint --key your_filename --version-id xod2CHTniex2vcATz0ByCLJzweygEJl

On success, the response is:

{
    "DeleteMarker": true,
    "VersionId": "xod2CHTniex2vcATz0ByCLJzweygEJl"
}

Check the VersionID to ensure that it is the VersionID of the delete marker. DO NOT use the VersionID of one of the object versions as it will cause that version of the object to be deleted.

The file is now restored.

Permanently Delete a Specific Version

Use the following command to return all object versions:

aws s3api list-object-versions --prefix your_filename --bucket your_bucket_name --endpoint=https://your_endpoint

This returns all object versions for files with your_filename in their name. In this instance, the object has three versions:

{
    "Versions": [
        {
            "ETag": "\"f0cfd2bdaa82e1a5ff0a32537c5d3b9a\"",
            "Size": 51730,
            "StorageClass": "STANDARD",
            "Key": "shark.png",
            "VersionId": "DcntGSvYg-oI..sID8OM7W524Ejofkf",
            "IsLatest": true,
            "LastModified": "2023-04-11T10:29:22.772000+00:00",
            "Owner": {
                "DisplayName": "12148280",
                "ID": "12148280"
            }
        },
        {
            "ETag": "\"a9d268788d4562567ce01136cc382ac4\"",
            "Size": 87721,
            "StorageClass": "STANDARD",
            "Key": "shark.png",
            "VersionId": "DqZI-H8.1BAnrXA7Py3jNNBRrcm4eu8",
            "IsLatest": false,
            "LastModified": "2023-04-11T10:28:58.990000+00:00",
            "Owner": {
                "DisplayName": "12148280",
                "ID": "12148280"
            }
        },
        {
            "ETag": "\"137057b79e68b856bb5f6a203f0c98eb\"",
            "Size": 190179,
            "StorageClass": "STANDARD",
            "Key": "shark.png",
            "VersionId": "j-pjg8GhKzotq1rG5XiT12Jhobj9kR7",
            "IsLatest": false,
            "LastModified": "2023-04-11T10:28:33.359000+00:00",
            "Owner": {
                "DisplayName": "12148280",
                "ID": "12148280"
            }
        }
    ]
}

Then, you can delete a specific version:

aws s3api delete-object --bucket your_bucket_name --endpoint=https://your_endpoint --key your_filename --version-id DqZI-H8.1BAnrXA7Py3jNNBRrcm4eu8

The command returns the following output:

{
    "VersionId": "DqZI-H8.1BAnrXA7Py3jNNBRrcm4eu8"
}

We can't find any results for your search.

Try using different keywords or simplifying your search terms.