Think before you speak, read before you think.

AWS S3 objects cleanup

by

in

Delete all objects with versions before you can delete the bucket

1. use python boto3

#!/usr/bin/env python
import boto3

bucket_name='dev-tfstate-bucket'

s3 = boto3.resource('s3')
bucket = s3.Bucket(bucket_name)
bucket.object_versions.all().delete()

2. Empty the bucket in the UI


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *