Skip to content

Instantly share code, notes, and snippets.

@joec4i
Created August 8, 2019 12:58
Show Gist options
  • Save joec4i/856ef7a616e4b4812b4c13d04ca7b234 to your computer and use it in GitHub Desktop.
Save joec4i/856ef7a616e4b4812b4c13d04ca7b234 to your computer and use it in GitHub Desktop.
A Python script to delete s3 bucket with object versions
import boto3
boto3.set_stream_logger('boto3.resources.action')
session = boto3.Session()
s3 = session.resource(service_name='s3')
bucket = s3.Bucket('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