Skip to main content

PutBucketVersioning

PutBucketVersioning sets a bucket's versioning state - whether overwriting or deleting an object keeps the earlier versions. Every STRG bucket is versioned from the moment it is created and stays that way, so there is nothing to switch on: a request asking for versioning, with Status Enabled or no Status at all, answers 200 OK and leaves the bucket as it is. Tools that enable versioning as part of their setup, such as Terraform and backup software, therefore work unchanged. GetBucketVersioning reads the state back.

Good to know on STRG
  • Status Enabled succeeds and changes nothing: the bucket is already versioned.
  • Versioning stays on for good, so Status Suspended is answered 501 NotImplemented and a client knows straight away.
  • STRG has no MFA delete: MfaDelete Enabled and the x-amz-mfa header are answered 501 NotImplemented.
  • Setting the versioning state is the work of an access key for all buckets holding Manage buckets.
  • x-amz-expected-bucket-owner is welcome and has nothing to check.

Because every bucket keeps every version, overwriting or deleting an object leaves its earlier versions in place: a delete writes a delete marker, and every version stays billed as stored data until it is permanently deleted or a lifecycle policy removes it.

When you'd use it​

  • An infrastructure-as-code tool such as Terraform describes a bucket with versioning enabled and sends PutBucketVersioning when it applies the configuration. STRG answers 200 OK, and the bucket matches the configuration from the start.
  • Backup software turns versioning on for its target bucket during setup, since versioning is what lets a backup be rolled back. The request succeeds and the backup carries on as usual.
  • A setup script written for Amazon S3 enables versioning right after creating a bucket. It runs against STRG as it is, with one step that is already done.

Request​

PUT /?versioning HTTP/1.1
Host: my-bucket.s3.eu-central-1.strg.com
Authorization: AWS4-HMAC-SHA256 Credential=...
x-amz-date: 20260926T120000Z
x-amz-content-sha256: <SHA-256 of the body, hex>
Content-MD5: <MD5 of the body, base64>
Content-Type: application/xml

<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
</VersioningConfiguration>

Path-style, the same request is PUT /my-bucket?versioning on s3.eu-central-1.strg.com. Addressing describes both styles.

Permissions​

The access key needs Manage buckets (buckets:write), which a key for all buckets can hold. A key without it gets 403 AccessDenied. Access keys has the details.

URI parameters​

NameTypeRequiredDescription
BucketStringYesThe bucket whose versioning state is set.
versioningFlagYesSelects the versioning subresource. Sent without a value.

Any other query parameter is answered 501 NotImplemented, so a client knows straight away that it has no effect here.

Request headers​

NameTypeRequiredDescription
Content-MD5StringNoThe base64 MD5 digest of the body. When it is sent, STRG checks it and answers 400 BadDigest if it does not match. The AWS SDKs and CLI compute it, or a checksum, on their own.
x-amz-sdk-checksum-algorithmStringNoAccepted, along with the checksum header the SDK sends beside it.
x-amz-mfaStringNoAnswered 501 NotImplemented: STRG has no MFA delete.
x-amz-expected-bucket-ownerStringNoWelcome, and has nothing to check: an access key only ever reaches its own account's buckets.

Request body​

A VersioningConfiguration document of at most 2 MiB.

ElementTypeRequiredDescription
VersioningConfigurationContainerYesThe root element. It may carry the xmlns attribute, and contains only Status and MfaDelete, each at most once.
StatusStringNoEnabled, or omitted: succeeds, with nothing to change. Suspended: answered 501 NotImplemented, since versioning stays on. Any other value: 400 MalformedXML.
MfaDeleteStringNoDisabled, or omitted: succeeds, with nothing to change. Enabled: answered 501 NotImplemented. Any other value: 400 MalformedXML.

The document is plain XML. A comment, CDATA section, DOCTYPE, processing instruction other than the XML declaration, namespace prefix, attribute other than xmlns or unknown element is answered 400 MalformedXML.

Response​

A successful request answers 200 OK with an empty body.

Response headers​

NameDescription
x-amz-request-idThe request ID, for support requests.

Response body​

None.

Errors​

These are the errors this operation can answer, and the situation behind each.

CodeHTTP statusWhen
NotImplemented501Status is Suspended, MfaDelete is Enabled, the request carries x-amz-mfa, it carries a query parameter other than versioning, or it sends the body as a streaming aws-chunked upload.
MalformedXML400The body is missing, is not a VersioningConfiguration document, carries an unknown or repeated element, uses one of the constructs listed under Request body, or has a Status or MfaDelete value S3 does not define.
MaxMessageLengthExceeded400The body is larger than 2 MiB.
BadDigest400Content-MD5 does not match the body.
XAmzContentSHA256Mismatch400x-amz-content-sha256 does not match the body.
NoSuchBucket404The bucket does not exist, it is in a region other than the endpoint's, or your account has no storage in this endpoint's region yet.
AccessDenied403The access key lacks Manage buckets, the request is unsigned or carries an x-amz-* header that is not signed, or your account is not active.
InvalidAccessKeyId403The access key does not exist, has expired or been revoked, or was created so recently that it is not yet usable in this endpoint's region - a moment later it is.
SignatureDoesNotMatch403The request signature is wrong.
RequestTimeTooSkewed403The request time is more than 15 minutes from the server's.
AuthorizationHeaderMalformed400The signature's credential scope names a region other than the endpoint's.
SlowDown503Too many requests at once; a retry after the Retry-After interval goes through.
ServiceUnavailable503A temporary failure; a retry usually succeeds.
InternalError500An unexpected failure; a retry usually succeeds.

Differences from Amazon S3​

A few things work a little differently on STRG, each listed here with what it means for your requests.

AspectAmazon S3STRG
New bucketUnversioned until versioning is first enabledVersioned from creation, with nothing to turn on
Status EnabledTurns versioning on, which can take up to 15 minutes to take full effectSucceeds straight away with nothing to change: versioning is already on
Status SuspendedSuspends versioning: new objects get the version ID null501 NotImplemented, and every version is kept. A lifecycle policy takes care of removing noncurrent versions
MFA deleteMfaDelete with the x-amz-mfa headerSTRG has no MFA delete: 501 NotImplemented
PermissionBucket ownerManage buckets, on an access key for all buckets
Bucket in another region301 redirect with x-amz-bucket-region404 NoSuchBucket, also from a region where your account stores nothing yet. Each bucket answers on its own regional endpoint
x-amz-expected-bucket-ownerChecked against the bucket ownerWelcome, with nothing to check: a key only ever reaches buckets of its own account

Examples​

Each example enables versioning on my-bucket - a request that succeeds and changes nothing, just as tools that enable versioning expect.

aws s3api put-bucket-versioning \
--bucket my-bucket \
--versioning-configuration Status=Enabled \
--endpoint-url https://s3.eu-central-1.strg.com \
--region eu-central-1

A request to suspend versioning is answered 501 NotImplemented. Keeping storage from growing with old versions is the work of a lifecycle policy that removes noncurrent versions, as in Keeping 30 days of old versions.

View as Markdown