How to fix CloudFormation DELETE_FAILED for IAM Roles?
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?
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests the ability to use
DeletionPolicy: Retainto bypass resource deletion failures and unblock the stack removal process.
To resolve CloudFormation DELETE_FAILED errors for stuck resources like IAM roles, the community consensus is to apply a DeletionPolicy: Retain to the resource. This allows the stack deletion to complete, enabling the developer to manually clean up the orphaned resource afterward.
A common mistake is choosing to contact AWS Support (Option A), as developers often overlook the ability to retain resources and manually clean them up to unblock the stack deletion.
Community Discussion (3 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option C is the correct action because when CloudFormation fails to delete a resource (often due to active dependencies or service constraints), the stack deletion halts. By modifying the template to setDeletionPolicy: Retain for the ASGInstanceRole12345678, CloudFormation skips the deletion of that specific resource, allowing the rest of the stack to be removed successfully. The developer can then manually resolve any dependencies and delete the role via the IAM console.Why the Other Options Are Wrong
Option A is incorrect because contacting AWS Support is unnecessary for this common scenario; manual intervention via the console is the standard first step. Option B is incorrect becauseDependsOn controls creation order and implicit dependencies, not the physical deletion capability of a resource that is failing to delete. Option D is incorrect because the CloudFormation API does not provide a generic 'force' parameter that accepts a role ARN to forcibly delete a specific resource during stack operations.Community Comment Notes
Community members confirm that manually deleting the IAM role after removing attached policies or instance profiles is the standard fix. One user explicitly validated the solution by providing the CloudFormation syntaxDeletionPolicy: Retain, reinforcing that this is the intended method to handle the DELETE_FAILED state for IAM roles. Official Reference
Exam Strategy
When encountering DELETE_FAILED errors, look for options involving DeletionPolicy: Retain or manual deletion. This allows you to bypass the automated failure and clean up the environment manually, which is a common pattern in AWS troubleshooting questions.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →