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?
- ARun 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.
- BExecute `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.
- 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
- DModify 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
Anahtar Kavram
Recovering CloudFormation stacks from the UPDATE_ROLLBACK_FAILED state.
Tahmini Süre:3m 0s