Question

How can I force delete my AWS cloud formation stack? The tied resources were already deleted previously like the DNS, route53, etc. Whenever I delete the stack, it failed because it couldn't find the resources.

The specified hosted zone does not exist. DELETE_FAILED.

This made the deletion halt and made the stack still active. How can I force clean-up and remove this stack?

Was it helpful?

Solution

Based on this thread, it appears that stack deletion can be problematic if the stack is altered.

https://forums.aws.amazon.com/thread.jspa?threadID=71050&start=0&tstart=0

Looks like you need to go via Support to get it deleted.

That said, I have been able to delete stacks where I have manually altered the components. Sometimes you need to wait a couple of hours after you terminate instances, VPCs, subnets etc before the stack deletion actually succeeds.

OTHER TIPS

AWS Cloud formation stack does not get deleted until all dependency resources either used in other stack or busy with non stack resources. So better see which resource is shared some where else and try to release that. hope that help.

It seems the Route53 records were either deleted manually before cloudformation or there was some failure within cloudformation after it deleted the record. Its stuck because it can't find the hosted zone because it was already deleted if indeed this is what was described in your post. You can try to update the stack with the original script and then delete the stack via cloudformation without any manual intervention.

Check your IAM role and the policy, review the privileges that you have associated with the role, so that if there is any permission issue, that should resolve the issue. Refer: https://aws.amazon.com/premiumsupport/knowledge-center/cloudformation-stack-delete-failed/

Need to check the reason for failure in stack details

Either delete this manually, or retain those resources while eleteing

eg: $ aws cloudformation delete-stack --stack-name my-stack --retain-resources myresource1 myresource2

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top