Skip to content

Manage Versioning in SCS3

When versioning is enabled, SCS3 will keep track of all changes to an object, allowing you to restore previous versions if needed.

This guide explains how to manage versioning in SCS3 using two S3-compatible clients: AWS CLI and Rclone.

Prerequisites

  • Obtain S3 keys through Switch Cloud Portal. Remember that each project has its own unique keys
  • AWS CLI (at least version 2.13) installed and configured with your S3 credentials. For more information about setting up AWS CLI with Switch Cloud S3 credentials visit User Authentication.

Check Versioning Status

To check versioning status on the bucket, run the following command:

aws s3api get-bucket-versioning --bucket <your-bucket-name>

Bucket versioning status (possible values:Enabled, Suspended):

Example output
{
    "Status": "Enabled"
}

If a bucket is unversioned the above command will give no output.

To check versioning status on the bucket, run the following command:

rclone backend versioning <s3_profile>:<your_bucket_name>

Bucket versioning status (possible values:Enabled, Suspended, Unversioned):

Example output
"Unversioned"

Enable Versioning

Important

Enabling versioning on a bucket does not apply versioning to existing objects. These objects remain unversioned but accessible. Versioning applies to new objects and to modifications or deletions of existing objects, which will create new versions. It is recommended to enable versioning at the time of bucket creation to ensure consistent versioning behavior from the start.

To enable versioning on the bucket, run (no output, if successful):

aws s3api put-bucket-versioning --bucket <your_bucket_name> --versioning-configuration Status=Enabled

You can check the status again using the get-bucket-versioning command.

To enable versioning on the bucket, run:

rclone backend versioning <s3_profile>:<your_bucket_name> Enabled
Example output
"Enabled"

Suspend Versioning

To suspend versioning on the bucket, run the following command (no output, if successful):

aws s3api put-bucket-versioning --bucket <your-bucket-name> --versioning-configuration Status=Suspended

To suspend versioning on the bucket, run the following command:

rclone backend versioning <s3_profile>:<your_bucket_name> Suspended
Example output
"Suspended"

List Object Versions

To list objects with all their versions, run the following command:

aws s3api list-object-versions --bucket <your-bucket-name> --prefix <object-key>
Example output
{
    "Versions": [
        {
            "ETag": "\"524c2b5dda474601d0d541e56b0b74fe\"",
            "Size": 4679,
            "StorageClass": "STANDARD",
            "Key": "empty.txt",
            "VersionId": ".7TCd9al7KDS9qLgoPogKug1xXMwE3m",
            "IsLatest": true,
            "LastModified": "2025-03-06T12:15:19.581000+00:00",
            "Owner": {
                "DisplayName": "Display_Name",
                "ID": "01951932-8144-7746-9308-eaf805667866"
            }
        },
        {
            "ETag": "\"70b69e9cf45c4043915d97a0d2c92a45\"",
            "Size": 26,
            "StorageClass": "STANDARD",
            "Key": "empty.txt",
            "VersionId": "-jTBIFZUOJgr.osgSmiVyZYQBQseCp8",
            "IsLatest": false,
            "LastModified": "2025-03-06T12:14:46.031000+00:00",
            "Owner": {
                "DisplayName": "Display_Name",
                "ID": "01951932-8144-7746-9308-eaf805667866"
            }
        },
        {
            "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
            "Size": 0,
            "StorageClass": "STANDARD",
            "Key": "empty.txt",
            "VersionId": "6XSJkis5GtARQDS-K2-5wdjYuSRGo24",
            "IsLatest": false,
            "LastModified": "2025-03-06T12:14:18.462000+00:00",
            "Owner": {
                "DisplayName": "Display_Name",
                "ID": "01951932-8144-7746-9308-eaf805667866"
            }
        }
    ],
    "RequestCharged": null,
    "Prefix": "empty.txt"
}

You may list all versions of all objects in a bucket by running:

rclone -q --s3-versions ls <s3_profile>:<your_bucket_name>
Example output
4679 empty.txt
26 empty-v2025-03-06-121446-031.txt
    0 empty-v2025-03-06-121418-462.txt
4724 folder/empty.txt
4679 folder/empty-v2025-03-06-123351-390.txt

Important

Note that Rclone displays versions differently than AWS CLI. Versions' names are created by inserting timestamp between file name and its extension.

Retrieve a Specific Version of an Object

To retrieve a specific version of an object, run the following command:

aws s3api get-object --bucket <your-bucket-name> --key <object-key> --version-id <version-id> <local-file>
Example output
{
    "AcceptRanges": "bytes",
    "LastModified": "2025-03-06T12:14:18+00:00",
    "ContentLength": 0,
    "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
    "VersionId": "6XSJkis5GtARQDS-K2-5wdjYuSRGo24",
    "ContentType": "text/plain; charset=utf-8",
    "Metadata": {
        "mtime": "1741260125.3916738"
    }
}

To retrieve a specific version of an object, run the following command (no output, if successful):

rclone -q --s3-versions copy <s3_profile>:<your_bucket_name>/<object_key> <destination_folder>

Important

To specify <object_key> use the exact version key as Rclone displays it, for example: empty-v2025-03-06-121446-031.txt

Delete a Specific Version of an Object

To delete a specific version of an object, run the following command:

aws s3api delete-object --bucket <your-bucket-name> --key <object-key> --version-id <version-id>
Example output
{
    "VersionId": "oHBhm8_SI5yFqmfFcoS3_5FgUekRg1vm"
}

To delete a specific version of an object, run the following command (no output, if successful):

$ rclone delete --s3-versions <s3_profile>:<your_bucket_name>/<object_key>

Warning

Deleting a specific object version permanently removes that version from the bucket. This action is irreversible.

For more detailed information about S3 versioning management, refer to the official documentation: