A developer attempts to create a new AWS CloudFormation stack to deploy a web application. The stack creation fails because of an invalid AMI ID parameter, and the stack enters the ROLLBACK_COMPLETE status. The developer updates the template with the correct AMI ID.
Which action should the developer take to deploy the resources successfully?
- Delete the stack in the ROLLBACK_COMPLETE status, and then create a new stack using the updated template.Answer
- BUpdate the existing stack directly in the ROLLBACK_COMPLETE status by uploading the updated template.
- CManually launch the EC2 instance with the correct AMI ID in the Amazon EC2 Console, and then perform a drift detection sync on the stack.
- DUse AWS Secrets Manager to store the correct AMI ID and force a dynamic reference update on the existing stack.
Answer
Delete the stack in the ROLLBACK_COMPLETE status, and then create a new stack using the updated template.
When a CloudFormation stack fails to create on its very first attempt, it rolls back all created resources and enters the ROLLBACK_COMPLETE status. Stacks in the ROLLBACK_COMPLETE status cannot be updated; they must be deleted before a new stack can be created with the same name and the corrected template.
Step-by-Step Solution
Key Concept
CloudFormation Stack Lifecycle and Rollback States