Question

Difficulty: HardTroubleshooting CloudFormation and CI/CD Deployments

A developer has configured a CI/CD pipeline using AWS CodePipeline. The pipeline has a deploy stage that uses AWS CloudFormation to update a production stack. During a recent deployment, the stack update failed due to an error in a custom resource, and the subsequent rollback attempt also failed, leaving the stack in the UPDATE_ROLLBACK_FAILED state. The developer has resolved the root cause of the custom resource failure in the CloudFormation template and committed the changes to the source repository. However, the pipeline is now failing at the CloudFormation deploy stage with an error stating that the stack cannot be updated in its current state. Which two actions should the developer take to resolve the deployment failure and successfully apply the changes? (Select TWO.)

  1. Execute the continue-update-rollback command via the AWS CLI or CloudFormation console to resume the rollback process and bring the stack to the UPDATE_ROLLBACK_COMPLETE state.Answer
  2. After the stack reaches a stable state, trigger the pipeline again to apply the updated template containing the fix.Answer
  3. C
    Run the update-stack CLI command directly with the --force flag while the stack is in the UPDATE_ROLLBACK_FAILED state to override the state validation.
  4. D
    Delete the stack using the delete-stack CLI command, then trigger the pipeline to perform a fresh stack creation.
  5. E
    Modify the CloudFormation service role's trust policy to allow the CodePipeline service role to assume it with the sts:AssumeRole action.

Answer

Execute the continue-update-rollback command via the AWS CLI or CloudFormation console to resume the rollback process and bring the stack to the UPDATE_ROLLBACK_COMPLETE state, and after the stack reaches a stable state, trigger the pipeline again to apply the updated template containing the fix.
The correct approach is to first return the CloudFormation stack to a stable state. This is achieved by executing the continue-update-rollback action, which moves the stack to UPDATE_ROLLBACK_COMPLETE. Once the stack is stable, the pipeline can be executed again to safely apply the corrected template configuration from the repository.

Step-by-Step Solution

1
Diagnose the current state of the AWS CloudFormation stack.
The stack is confirmed to be in the UPDATE_ROLLBACK_FAILED state, meaning that the update failed and the subsequent rollback attempt also failed.
You must identify the stack state to determine the appropriate recovery API call, as CloudFormation prevents updates on stacks that are not in a stable state.
2
Resume the rollback using AWS CloudFormation CLI or Console.
By executing 'aws cloudformation continue-update-rollback', CloudFormation attempts to roll back the remaining resources. If specific resources continue to fail, they can be skipped during this process.
This action moves the stack from the unstable UPDATE_ROLLBACK_FAILED state to the stable UPDATE_ROLLBACK_COMPLETE state.
3
Redeploy the corrected template by triggering the CI/CD pipeline.
The pipeline runs successfully, executing the CloudFormation update stage to apply the bug fix to the resources.
Once the stack is stable in the UPDATE_ROLLBACK_COMPLETE state, it can accept new update commands to apply the corrected template configuration.

Key Concept

Handling AWS CloudFormation stack update rollback failures by resuming the rollback process to reach a stable state before applying further updates.
Rate this question