Category: AWS

  • AWS S3 objects cleanup

    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