Skip to content

Instantly share code, notes, and snippets.

@gabanox
Created June 7, 2021 01:10
Show Gist options
  • Save gabanox/4a84d984a7e4ac5d1d3ecacb4f1d54e3 to your computer and use it in GitHub Desktop.
Save gabanox/4a84d984a7e4ac5d1d3ecacb4f1d54e3 to your computer and use it in GitHub Desktop.
Delete versions from a bucket in S3
import sys
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket(sys.argv[1])
bucket.object_versions.delete()
bucket.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment