💾 Archived View for cfdocs.wetterberg.nu › using-cfn-updating-stacks-continueupdaterollback.gemini captured on 2024-05-12 at 15:29:25. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
A stack goes into the `UPDATE_ROLLBACK_FAILED` state when AWS CloudFormation cannot roll back all changes during an update. For example, you might have a stack that begins to roll back to an old database instance that was deleted outside of AWS CloudFormation. Because AWS CloudFormation doesn't know that the database was deleted, it assumes that the database instance still exists and attempts to roll back to it, causing the update rollback to fail.
When a stack is in the `UPDATE_ROLLBACK_FAILED` state, you can continue to roll it back to a working state (`UPDATE_ROLLBACK_COMPLETE`). You can't update a stack that is in the `UPDATE_ROLLBACK_FAILED` state. However, if you can continue to roll it back, you can return the stack to its original settings and then try to update it again.
In most cases, you must fix the error that causes the update rollback to fail before you can continue to roll back your stack. In other cases, you can continue to roll back the update without any changes, for example when a stack operation times out.
If you use nested stacks, rolling back the parent stack will attempt to roll back all the child stacks as well.
https://console.aws.amazon.com/cloudformation
The following diagram shows a nested stacks hierarchy that is in the `UPDATE_ROLLBACK_FAILED` state. In this example, the `WebInfra` root stack has two nested stacks: `WebInfra-Compute` and `WebInfra-Storage`, which in turn have one or more nested stacks.
{P Image}
The stack names in this example are truncated for simplicity. Child stack names are typically generated by AWS CloudFormation and contain unique random strings, so actual names might not be user-friendly.
To successfully get the root stack into an operable state using `continue-update-rollback`, you must use the `resources-to-skip` parameter to skip resources that failed to rollback. In this example, `resources-to-skip` would include the following items:
The following example is the full CLI command:
1. PROMPT> aws cloudformation continue-update-rollback --stack-name WebInfra --resources-to-skip myCustom WebInfra-Compute-Asg.myAsg WebInfra-Compute-LB.myLoadBalancer WebInfra-Storage.DB
Note that we specified resources from nested stacks by using the `NestedStackName.ResourceLogicalID` format, but for the resources of the root stack, such as *myCustom*, we specified only the logical ID.
You can find a child stack's name in its stack ID or Amazon Resource Name (ARN). In the following example, the stack name is *WebInfra\-Storage\-Z2VKC706XKXT*:
`arn:aws:cloudformation:us-east-1:123456789012:stack/WebInfra-Storage-Z2VKC706XKXT/ea9e7f90-54f7-11e6-a032-028f3d2330bd`
You can find a child stack's logical ID in the template definition of its parent. In the diagram, the `LogicalId` of the `WebInfra-Storage-DB` child stack is *DB* in its parent `WebInfra-Storage`.
In the AWS CloudFormation console, you can also find the logical ID in the *Logical ID* column for the stack resource on the *Resources* tab or the *Events* tab.