Mass delete cloudformation stacks

The oneliner:

# This will delete all stacks in the account connected to yourprofile with the string "delete-me" in the stackname
for StackName in $(aws --profile yourprofile cloudformation list-stacks --query 'StackSummaries[?contains(StackName, `delete-me`) == `true`] .StackName' --output text); do echo $StackName ; aws --profile yourprofile cloudformation delete-stack --stack-name $StackName ; done
Cloud & Open-Source magician 🧙‍♂️

I try to find the KISS in complex systems and share it with the world.

comments powered by Disqus