Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ArchTaqi/51c6ed7fa0fbd5b62caab1f14ba0ad97 to your computer and use it in GitHub Desktop.
Save ArchTaqi/51c6ed7fa0fbd5b62caab1f14ba0ad97 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