Skip to content

Instantly share code, notes, and snippets.

@gene1wood
Created April 29, 2021 00:51
Show Gist options
  • Save gene1wood/6dd6da0be96d54dc2fc55b4e88e1a775 to your computer and use it in GitHub Desktop.
Save gene1wood/6dd6da0be96d54dc2fc55b4e88e1a775 to your computer and use it in GitHub Desktop.
Command to delete all objects from S3 bucket using lifecycle configuration
for bucket in `cat list-of-s3-buckets.txt`; do
aws s3api put-bucket-lifecycle \
--bucket $bucket \
--lifecycle-configuration '{"Rules":[{"ID":"cleanup","Status":"Enabled","Prefix":"","Expiration":{"Days":1}}]}';
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment