DVA-C02 · Question #406
A developer received the following error message during an AWS CloudFormation deployment: DELETE_FAILED (The following resource(s) failed to delete: [ASGInstanceRole12345678].) Which action should…
The correct answer is C. Modify the CloudFormation template to retain the ASGInstanceRole12345678 resource. Then. When a CloudFormation stack fails to delete a resource, the recommended resolution is to configure the resource with a Retain deletion policy, complete the stack deletion, and then manually delete the retained resource.
Question
A developer received the following error message during an AWS CloudFormation deployment:
DELETE_FAILED (The following resource(s) failed to delete: [ASGInstanceRole12345678].) Which action should the developer take to resolve this error?
Options
- AContact AWS Support to report an issue with the Auto Scaling Groups (ASG) service.
- BAdd a DependsOn attribute to the ASGInstanceRole12345678 resource in the CloudFormation
- CModify the CloudFormation template to retain the ASGInstanceRole12345678 resource. Then
- DAdd a force parameter when calling CloudFormation with the role-arn of
How the community answered
(43 responses)- A7% (3)
- B14% (6)
- C77% (33)
- D2% (1)
Why each option
When a CloudFormation stack fails to delete a resource, the recommended resolution is to configure the resource with a Retain deletion policy, complete the stack deletion, and then manually delete the retained resource.
A DELETE_FAILED for an IAM role is a resolvable configuration issue (typically a role still in use), not an AWS service defect requiring a support escalation.
The DependsOn attribute controls resource creation and deletion ordering within a stack but does not resolve an underlying deletion failure caused by the resource being referenced by other services.
Setting the DeletionPolicy to Retain on the problematic resource (ASGInstanceRole12345678) instructs CloudFormation to skip deleting it during stack teardown. Once the stack deletion succeeds, the developer can investigate the root cause and manually delete the retained IAM role after resolving any dependencies blocking its removal.
CloudFormation does not support a 'force' parameter combined with role-arn to override deletion failures; this is not a valid CloudFormation API option.
Concept tested: CloudFormation DeletionPolicy Retain to resolve DELETE_FAILED
Source: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
Community Discussion
No community discussion yet for this question.