# How to enable versioning on an object storage bucket

Source: https://docs.quake.ai/docs/object/how-to/enable-versioning
Markdown: https://docs.quake.ai/docs/object/how-to/enable-versioning.md

---

# How to enable versioning on an object storage bucket

Enable versioning on an object storage bucket to retain all versions of each object. Versioning protects against accidental overwrites and deletions; you can restore any previous version at any time.



Versioning is configured via the S3-compatible API. No versioning toggle exists in the Console. You need [S3 credentials](/docs/object/how-to/create-s3-credentials) to use the S3 API for bucket versioning.



**Key behaviors:**

- Each object version counts against your storage quota.
- Deleting an object in a versioned bucket adds a *delete marker*; the object still exists in previous versions.
- Once enabled, versioning can only be suspended, not removed.
- All versions of an object are visible via S3 API calls; the console shows only the current version.

<PrerequisiteBlock methods={["cli", "api"]}>

- An existing object storage bucket
- [S3 credentials](/docs/object/how-to/create-s3-credentials) with access to the bucket

</PrerequisiteBlock>

## Enable versioning

<MethodTabs>
<Method label="CLI">




```bash
s3cmd setversioning s3://my-bucket enable
```




```bash
aws s3api put-bucket-versioning \
  --bucket my-bucket \
  --versioning-configuration Status=Enabled \
  --endpoint-url "https://object.us-east-1.rumble.cloud"
```




</Method>
<Method label="API">

Using the S3-compatible API:

```bash
curl -X PUT "https://object.us-east-1.rumble.cloud/my-bucket?versioning" \
  -H "Authorization: AWS YOUR_ACCESS_KEY:SIGNATURE" \
  -H "Content-Type: application/xml" \
  -d '<VersioningConfiguration><Status>Enabled</Status></VersioningConfiguration>'
```




```python
import boto3

s3 = boto3.resource(
    "s3",
    endpoint_url="YOUR_S3_ENDPOINT",
    aws_access_key_id="YOUR_ACCESS_KEY",
    aws_secret_access_key="YOUR_SECRET_KEY",
)

versioning = s3.BucketVersioning("my-bucket")
versioning.enable()
print(f"Versioning is {versioning.status}")
```




</Method>
</MethodTabs>

## Suspend versioning

Suspending versioning stops new versions from being created. Existing versions are preserved.

<MethodTabs>
<Method label="CLI">




```bash
s3cmd setversioning s3://my-bucket disable
```




```bash
aws s3api put-bucket-versioning \
  --bucket my-bucket \
  --versioning-configuration Status=Suspended \
  --endpoint-url "https://object.us-east-1.rumble.cloud"
```




</Method>
<Method label="API">

```bash
curl -X PUT "https://object.us-east-1.rumble.cloud/my-bucket?versioning" \
  -H "Authorization: AWS YOUR_ACCESS_KEY:SIGNATURE" \
  -H "Content-Type: application/xml" \
  -d '<VersioningConfiguration><Status>Suspended</Status></VersioningConfiguration>'
```




```python
import boto3

s3 = boto3.resource(
    "s3",
    endpoint_url="YOUR_S3_ENDPOINT",
    aws_access_key_id="YOUR_ACCESS_KEY",
    aws_secret_access_key="YOUR_SECRET_KEY",
)

versioning = s3.BucketVersioning("my-bucket")
versioning.suspend()
print(f"Versioning is {versioning.status}")
```




</Method>
</MethodTabs>

## List versioned objects

<MethodTabs>
<Method label="CLI">

```bash
aws s3api list-object-versions \
  --bucket my-bucket \
  --endpoint-url "https://object.us-east-1.rumble.cloud"
```

</Method>
<Method label="API">

```bash
aws s3api list-object-versions \
  --bucket my-bucket \
  --endpoint-url "https://object.us-east-1.rumble.cloud" \
  --output json
```




```python
import boto3

s3_client = boto3.client(
    "s3",
    endpoint_url="YOUR_S3_ENDPOINT",
    aws_access_key_id="YOUR_ACCESS_KEY",
    aws_secret_access_key="YOUR_SECRET_KEY",
)

response = s3_client.list_object_versions(Bucket="my-bucket")
for version in response.get("Versions", []):
    print(version["Key"], version["VersionId"], version["IsLatest"])
```




</Method>
</MethodTabs>

## Delete a specific object version

Deleting a specific version permanently removes it and frees the storage.

```bash
aws s3api delete-object \
  --bucket my-bucket \
  --key file.txt \
  --version-id VERSION_ID \
  --endpoint-url "https://object.us-east-1.rumble.cloud"
```

Deleting an object without specifying a version in a versioned bucket adds a delete marker. The object appears deleted in normal listings but the versions remain and consume storage.

## See also

- [Create an object storage bucket](/docs/object/how-to/create-container)
- [Create S3 credentials](/docs/object/how-to/create-s3-credentials)
- [Grant access control](/docs/object/how-to/grant-access-control)
