rebuy-de / aws-nuke

Nuke a whole AWS account and delete all its resources.
https://github.com/ekristen/aws-nuke
MIT License
5.76k stars 725 forks source link

Retain all resources created by CloudFormation Stack #431

Closed swatigem13 closed 1 month ago

swatigem13 commented 4 years ago

Hi, We are using aws-nuke at our workplace and it is amazingly useful so Thank you for that ! However, I wanted to check if there is any way to retain all resources created by a CloudFormation Stack? We have a use case where we we want to retain all the resources created by a CloudFormation stack without having to specify each resource created by this CloudFormation in the filter. Every time a new resource is added to the stack, we are having to update our nuke config file to add it to the filter. Just need some help to see if the existing product already provides this feature.

Thanks !

svenwltr commented 4 years ago

Hello @swatigem13. This is an interesting feature, which already came up a few times. Unfortunately this is currently quite hard with aws-nuke, since all resources are listed independently. It would be a huge change to change that behavior.

adamcousins commented 4 years ago

@swatigem13 One way to achieve this is to use filters with pattern matching.

This will require you would either name all resources specifically (ie. IAM Roles Name is dont-delete-me-please, where your filter would match dont-delete*), or you let Cloudformation name all resources and you would use the stack name as the filter patttern match to ignore.

swatigem13 commented 4 years ago

Thanks @svenwltr @adamcousins. We are following similar naming conventions for all our resources and filtering them with regular expressions per resource type. That has solved our problem to a great extent. I am happy to close this issue considering that it requires a huge change to the product and it is something that is already in your backlog :)

Cajga commented 2 years ago

We are using Control Tower which creates resources in each of our AWS accounts using Cloud Formation stacks. As we have no possibility to change the name of the resources created by the Cloud Formation stacks (the stacks are maintained by AWS and a third party company) coming from CT, we cannot use the proposed workaround. The only workaround that we could see is to generate the config automatically excluding those resources by a script. It wo8uld be really nice to have a native feature for this in aws-nuke.

ekristen commented 1 month ago

A feature called Global Filters has been implemented in the now active managed fork of aws-nuke.

This may or may not allow you to do what you are wanting.

If you have a chance, please check it out and let us know if you run into an issues by opening an issue over on the fork.


Please see the copy of the notice from the README about the deprecation of this project. Sven was kind enough to grant me access to help triage and close issues and pull requests that have already been addressed in the actively maintained fork. Some additional information is located in the welcome issue for more information.

[!CAUTION] This repository for aws-nuke is no longer being actively maintained. We recommend users to switch to the actively maintained fork of this project at ekristen/aws-nuke. We appreciate all the support and contributions we've received throughout the life of this project. We believe that the fork will continue to provide the functionality and support that you have come to expect from aws-nuke. Please note that this deprecation means we will not be addressing issues, accepting pull requests, or making future releases from this repository. Thank you for your understanding and support.