PutBucketVersioning
Sets the versioning state of an existing bucket
Last updated
Sets the versioning state of an existing bucket
Last updated
You can set the versioning state with one of the following values:
Enabled
Enables versioning for the objects in the bucket. All objects added to the bucket receive a unique version ID.
Disables versioning for the objects in the bucket. All objects added to the bucket receive the version ID null.
If the versioning state has never been set on a bucket, it has no versioning state; a request does not return a versioning state value.
Important
If you have an object expiration lifecycle configuration in your non-versioned bucket and you want to maintain the same permanent delete behavior when you enable versioning, you must add a noncurrent expiration policy. The noncurrent expiration lifecycle configuration will manage the deletes of the noncurrent object versions in the version-enabled bucket. (A version-enabled bucket maintains one current and zero or more noncurrent object versions.)
The request uses the following URI parameters.
The bucket name.
Required: Yes
For requests made using the AWS Command Line Interface (CLI) or AWS SDKs, this field is calculated automatically.
The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code 403 Forbidden
(access denied).
The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.
The request accepts the following data in XML format.
Root level tag for the VersioningConfiguration parameters.
Required: Yes
The versioning state of the bucket.
Type: String
Valid Values: Enabled | Suspended
Required: No
If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.
The following request enables versioning for the specified bucket.
This example illustrates one usage of PutBucketVersioning.
The following request suspends versioning for the specified bucket.
This example illustrates one usage of PutBucketVersioning.
The base64-encoded 128-bit MD5 digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see .