3

I wrote a CloudFormation template which creates a whole environment which includes the creation of VPC, HostedZone, Subnets, Autoscaling Groups, etc...

The servers which are created and are members of the ASG's are running a user-data script the first time they are starting, which along many other tasks, each instance also registers itself in the newly created HostedZone.

Everything works perfect.

The problem is when I mark the stack for deletion it fails (DELETE_FAILED) and the reason is that CloudFormation was not able to delete the HostedZone.

Even if you try deleting manually a hosted zone which contains more than the required records (NS records) you get an error saying that you need to delete all the non-required records in the zone before you are able to delete the zone.

This also happens in CloudFormation and that is the reason for the "delete failed".

The error in CloudFormation looks like that:

The specified hosted zone contains non-required resource record sets and so cannot be deleted.

I was wondering if there's a workaround to avoid getting the "delete failed" message and that the stack will be deleted properly?

Itai Ganot
  • 10,424
  • 27
  • 88
  • 143

0 Answers0