Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete AWS Cloud formation stack with resources created by it

Based on this page I can do:

aws cloudformation delete-stack \
    --stack-name my-stack

It says I can attach the command: [--retain-resources <value>]

Does that mean that if I don't specify that line, all the resources created by the stack will be removed? I'm trying to delete everything generated by the stack, which is a lot.

How can I achieve this?

Thanks

like image 926
ElKePoN Avatar asked Aug 02 '26 11:08

ElKePoN


1 Answers

Yes, those resources will be kept if you specify the [--retain-resources <value>], if you dont Cloudformation will delete all the resources in the stack name (including the nested stacks as well) you are providing given you have permissions to do. If any of the resources inside the cloudformation stack has retain policy set they won't be deleted.

During deletion, AWS CloudFormation deletes the stack but does not delete the retained resources.

From the same page aws cloudformation delete-stack

You might wanna read this too How do I retain some of my resources when I delete an AWS CloudFormation stack?

You can specify the retain policy as well in cloudformation template.

like image 125
samtoddler Avatar answered Aug 05 '26 10:08

samtoddler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!