CloudFormation is buggy and won't properly clean up VPC and Internet Gateway

0

I'm using the eksctl utility to build and destroy Kubernetes clusters on Amazon EKS. When I delete the CloudFormation stacks, most of the resources are properly destroyed, including the EKS cluster itself. However, the VPC and Internet Gateway are getting hung up, and will not clean up properly. This is leaving my account with a bunch of orphaned VPC resources that I don't want, and contributing to my resource limits unnecessarily. The CloudFormation stacks get stuck in the DELETE_FAILED state.

The vpc 'vpc-096bd7c39859b6afb' has dependencies and cannot be deleted. (Service: AmazonEC2; Status Code: 400; Error Code: DependencyViolation; Request ID: 28dda82e-9aa9-4d05-b870-9371d77cee23; Proxy: null)
The internetGateway 'igw-0c214b63b8b795b81' has dependencies and cannot be deleted. (Service: Ec2, Status Code: 400, Request ID: 71c41fe9-1247-4a29-ac47-d5c32d29837d, Extended Request ID: null)

Question: Can the AWS CloudFormation team fix this, so that the resources are properly cleaned up?

1개 답변
2
수락된 답변

As noted here, do you have any active services associated with LBs in your EKS cluster?

If so, you should delete those services through kubectl and wait until the LBs are deleted properly.

Also generally it is recommended you use eksctl, or ensure you followed the steps in the above page when deleting clusters.

As a last resort, you can try to delete the IGWs and resources, such as ELBs, within the VPC manually to resolve dependencies and clean up resources.

Jason_S
답변함 2년 전
  • Yes that is the case. Thanks for pointing that out. I actually discovered that by attempting to manually delete one of the VPCs, and noticed there were ENIs attached to it. However, the CloudFormation service could do a much better job of describing why the stack fails to delete.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠