A developer is attempting to deploy an application update using AWS CloudFormation. The initial creation of the stack failed due to a misconfigured resource, leaving the stack in the ROLLBACK_COMPLETE state. When the developer attempts to run the `aws cloudformation update-stack` command with a corrected template, the command fails with a ValidationError. Which of the following actions must the developer take to successfully deploy the corrected template?
- ACreate and execute a CloudFormation change set against the existing stack to apply the template changes.
- BModify the trust policy of the CloudFormation execution role to explicitly allow the UpdateStack action on the resource.
- Delete the existing CloudFormation stack and then create a new stack using the corrected template.Answer
- DMove the buildspec.yml file to a subdirectory in the source repository to trigger a pipeline execution that bypasses the stack rollback.
Answer
Delete the existing CloudFormation stack and then create a new stack using the corrected template.
The correct answer is to delete the existing stack and create a new one. When a stack fails its initial creation, it rolls back to the ROLLBACK_COMPLETE state. Stacks in this state cannot be updated or modified via change sets. The only way to redeploy under the same stack name is to delete the failed stack and run a new creation process.
Step-by-Step Solution
Key Concept
Handling CloudFormation ROLLBACK_COMPLETE state
Estimated Time:1m 30s