Soru

Zorluk: Çok zorTroubleshooting CloudFormation and CI/CD Deployments

An organization uses AWS CodePipeline to automate their application deployment. During a recent deployment, an AWS CloudFormation action updating a nested stack fails, triggering a rollback. The parent stack fails to roll back completely and becomes stuck in the `UPDATE_ROLLBACK_FAILED` state because a Lambda function backing a Custom Resource was manually deleted prior to the deployment. Which action should the developer take to resolve this issue and return the stack to a stable state?

  1. A
    Run drift detection on the parent stack to identify the deleted Lambda function as drifted, import the resource status back into CloudFormation using `aws cloudformation import-resource-to-stack`, and execute a rollback from the console.
  2. B
    Execute `aws cloudformation update-stack` with a modified template that excludes the custom resource, using the `--disable-rollback` flag to force CloudFormation to bypass the current rollback state.
  3. Execute the `continue-update-rollback` command in the AWS CLI, specifying the logical ID of the failed custom resource in the `--resources-to-skip` parameter to transition the stack to `UPDATE_ROLLBACK_COMPLETE`. Afterward, recreate the Lambda function or update the template to point to a valid resource, and redeploy.Cevap
  4. D
    Modify the trust policy of the CloudFormation service role to allow it to assume the execution role of the deleted Lambda function, and then run `aws cloudformation update-stack` to remove the custom resource.

Cevap

Execute the `continue-update-rollback` command in the AWS CLI, specifying the logical ID of the failed custom resource in the `--resources-to-skip` parameter to transition the stack to `UPDATE_ROLLBACK_COMPLETE`. Afterward, recreate the Lambda function or update the template to point to a valid resource, and redeploy.
When a Custom Resource's provider (like a Lambda function) is deleted, CloudFormation cannot invoke the cleanup logic during rollback, which leaves the stack in the `UPDATE_ROLLBACK_FAILED` state. The developer must use the `continue-update-rollback` command with the `--resources-to-skip` parameter. This allows CloudFormation to bypass execution of the missing resource's logic and transitions the stack to `UPDATE_ROLLBACK_COMPLETE`. After the stack is in a stable state, proper template fixes can be safely applied.

Adım Adım Çözüm

1
Analyze the state of the CloudFormation stack.
The stack is stuck in `UPDATE_ROLLBACK_FAILED` because a Custom Resource's deletion/cleanup handler failed (due to the missing backing Lambda function).
You cannot perform direct updates or standard rollbacks while a stack is in this non-stable state.
2
Execute the recovery operation using the AWS CLI or Console.
Run `aws cloudformation continue-update-rollback --stack-name <stack-name> --resources-to-skip <failed-custom-resource-logical-id>`.
This instructs CloudFormation to skip the cleanup behavior for the deleted Lambda-backed Custom Resource and force the stack into `UPDATE_ROLLBACK_COMPLETE`.
3
Remediate and redeploy.
Update the template with correct Lambda ARNs or recreate the missing Lambda resource, then run the pipeline deployment again.
Now that the stack is in a stable state (`UPDATE_ROLLBACK_COMPLETE`), new deployment updates can be accepted.

Anahtar Kavram

Recovering CloudFormation stacks from the UPDATE_ROLLBACK_FAILED state.
Tahmini Süre:3m 0s
Bu soruyu puanla