Skip to content

Instantly share code, notes, and snippets.

@ezaurum
Created April 11, 2023 11:47
Show Gist options
  • Save ezaurum/acc93d13ae5cdef5812672519f4a6fe6 to your computer and use it in GitHub Desktop.
Save ezaurum/acc93d13ae5cdef5812672519f4a6fe6 to your computer and use it in GitHub Desktop.
Emptify S3 bucket
#!/usr/bin/env python
import boto3
import sys
PROFILE = sys.argv[1]
BUCKET = sys.argv[2]
session = boto3.Session(profile_name = PROFILE)
s3 = session.resource('s3')
bucket = s3.Bucket(BUCKET)
bucket.object_versions.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment