Question

Difficulty: MediumTroubleshooting CloudFormation and CI/CD Deployments

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?

  1. A
    Create and execute a CloudFormation change set against the existing stack to apply the template changes.
  2. B
    Modify the trust policy of the CloudFormation execution role to explicitly allow the UpdateStack action on the resource.
  3. Delete the existing CloudFormation stack and then create a new stack using the corrected template.Answer
  4. D
    Move 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

1
Identify the current state of the failed CloudFormation stack.
The stack is found to be in the ROLLBACK_COMPLETE state following a failed initial creation attempt.
Understanding the exact state helps determine whether the stack can accept updates or must be deleted.
2
Delete the existing failed stack using the AWS Management Console or the AWS CLI.
The stack in the ROLLBACK_COMPLETE state is completely removed from the AWS account.
AWS CloudFormation does not allow updates to stacks that failed their initial creation and rolled back.
3
Run the create-stack command using the corrected CloudFormation template.
A new stack is successfully created with the resource configurations applied.
Creating a new stack is the only way to deploy the resource once the blocked stack is removed.

Key Concept

Handling CloudFormation ROLLBACK_COMPLETE state
Estimated Time:1m 30s
Rate this question