BucketVersioning / Action / enable
enable¶
- S3.BucketVersioning.enable(**kwargs)¶
- Note- This operation is not supported for directory buckets. - Note- When you enable versioning on a bucket for the first time, it might take a short amount of time for the change to be fully propagated. While this change is propagating, you might encounter intermittent - HTTP 404 NoSuchKeyerrors for requests to objects created or updated after enabling versioning. We recommend that you wait for 15 minutes after enabling versioning before issuing write operations (- PUTor- DELETE) on objects in the bucket.- Sets the versioning state of an existing bucket. - 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. - Suspended—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 GetBucketVersioning request does not return a versioning state value. - In order to enable MFA Delete, you must be the bucket owner. If you are the bucket owner and want to enable MFA Delete in the bucket versioning configuration, you must include the - x-amz-mfa requestheader and the- Statusand the- MfaDeleterequest elements in a request to set the versioning state of the bucket.- Warning- 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.) For more information, see Lifecycle and Versioning. - The following operations are related to - PutBucketVersioning:- Warning- You must URL encode any signed header values that contain spaces. For example, if your header value is - my file.txt, containing two spaces after- my, you must URL encode this value to- my%20%20file.txt.- See also: AWS API Documentation - Request Syntax- response = bucket_versioning.enable( ChecksumAlgorithm='CRC32'|'CRC32C'|'SHA1'|'SHA256'|'CRC64NVME', MFA='string', ExpectedBucketOwner='string' ) - Parameters:
- ChecksumAlgorithm (string) – - Indicates the algorithm used to create the checksum for the request when you use the SDK. This header will not provide any additional functionality if you don’t use the SDK. When you send this header, there must be a corresponding - x-amz-checksumor- x-amz-trailerheader sent. Otherwise, Amazon S3 fails the request with the HTTP status code- 400 Bad Request. For more information, see Checking object integrity in the Amazon S3 User Guide.- If you provide an individual checksum, Amazon S3 ignores any provided - ChecksumAlgorithmparameter.
- MFA (string) – The concatenation of the authentication device’s serial number, a space, and the value that is displayed on your authentication device. The serial number is the number that uniquely identifies the MFA device. For physical MFA devices, this is the unique serial number that’s provided with the device. For virtual MFA devices, the serial number is the device ARN. For more information, see Enabling versioning on buckets and Configuring MFA delete in the Amazon Simple Storage Service User Guide. 
- ExpectedBucketOwner (string) – The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code - 403 Forbidden(access denied).
 
- Returns:
- None