Skip to content

Instantly share code, notes, and snippets.

@douglampe
Created November 26, 2021 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglampe/9004098a7bcb7c70f38b9c1ba25f9cdc to your computer and use it in GitHub Desktop.
Save douglampe/9004098a7bcb7c70f38b9c1ba25f9cdc to your computer and use it in GitHub Desktop.
Delete all versions from an S3 bucket
aws s3api delete-objects \
--bucket ${bucket_name} \
--delete "$(aws s3api list-object-versions \
--bucket "${bucket_name}" \
--output=json \
--query='{Objects: Versions[].{Key:Key,VersionId:VersionId}}')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment