Stack Deletion Failures: Possible Reasons | AWS Certified DevOps Engineer Exam

Troubleshooting Stack Deletion Failures

Prev Question Next Question

Question

Your company has a number of Cloudformation stacks defined in AWS.

As part of the routine housekeeping activity, a number of stacks have been targeted for deletion.

But a few of the stacks are not getting deleted and are failing when you are trying to delete them.

Which of the following could be valid reasons for this? Choose 2 answers from the options given below.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - B and C.

The AWS documentation mentions the below point.

Some resources must be empty before they can be deleted.

For example, you must delete all objects in an Amazon S3 bucket or remove all instances in an Amazon EC2 security group before you can delete the bucket or security group.

For more information on troubleshooting cloudformation stacks , please visit the below URL:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html

The correct answers are B and C.

B. The stack has an S3 bucket defined which has objects present in it. If an S3 bucket is defined in the CloudFormation stack, and it contains objects, then the stack deletion will fail because S3 buckets with objects cannot be deleted. The objects must be deleted first before the S3 bucket can be deleted.

C. The stack has an EC2 Security Group which has EC2 Instances attached to it. If an EC2 Security Group has EC2 instances attached to it, then the stack deletion will fail because the Security Group is being used by other resources. To delete the stack, the EC2 instances need to be detached from the Security Group first, or the Security Group needs to be deleted from the EC2 instances before attempting to delete the stack.

A. The stacks were created with the wrong template version. Since the standard template version is now higher, it is preventing the deletion of the stacks. You need to contact AWS support. This is not a valid reason for CloudFormation stack deletion failure. CloudFormation can delete stacks created with any valid CloudFormation template version. AWS support may be contacted for issues related to stack deletion, but not because of the wrong template version.

D. The stack consists of an EC2 resource which was created with a custom AMI. This is also not a valid reason for stack deletion failure. CloudFormation can delete stacks that include EC2 instances created with custom AMIs. If an issue arises, it would most likely be related to the underlying resources and not the custom AMI.