Skip to content

Instantly share code, notes, and snippets.

@julcap
Created August 31, 2017 11:35
Show Gist options
  • Save julcap/d263cacec04320b9389d1ac3d925278a to your computer and use it in GitHub Desktop.
Save julcap/d263cacec04320b9389d1ac3d925278a to your computer and use it in GitHub Desktop.
Delete all bucket object versions
#!/usr/bin/env python
BUCKET = 'your_bucket_name'
import boto3
s3 = boto3.resource('s3')
for obj in s3.Bucket(BUCKET).object_versions.all():
print(obj.delete())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment