Created
April 20, 2018 06:05
-
-
Save TJC/2586dea8b99085c9df7a8bc4f4cc968f to your computer and use it in GitHub Desktop.
Empty and remove an S3 bucket containing versioned file tombstones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # This took several days to run, but worked. Unlike the lifecycle rules I'd tried to use instead. | |
| import boto3 | |
| session = boto3.Session() | |
| s3 = session.resource(service_name='s3') | |
| bucket = s3.Bucket('your-bucket-name') | |
| bucket.object_versions.delete() | |
| bucket.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment