To stop versioning in an S3 Bucket, we can use the boto3 method put_bucket_versioning()
with the VersioningConfiguration
parameter to be set to a Status
of Suspended
.
Below are 3 methods on how we can stop versioning in an S3 Bucket using AWS-SDK for Python, boto3.
- Example 1: Disable file versioning in an S3 Bucket using boto3 S3 client
- Example 2: Disable file versioning in an S3 Bucket using boto3 S3 resource via Bucket object
- Example 3: Disable file versioning in an S3 Bucket using boto3 S3 resource via S3 Versioning object
The Python scripts below do the same thing: suspend the versioning of the target S3 Bucket named ‘radishlogic-bucket’.
You may use any method that you like depending on which you are comfortable using.
Interestingly, suspending versioning uses the same boto3 method as enabling versioning, put_bucket_versioning(). The only difference is that the ‘Status’ is ‘Suspended’ instead of ‘Enabled’.
Continue reading How to stop object file versioning in an S3 Bucket using Python boto3