A company uses AWS CloudFormation to deploy a multi-tier web application. The template includes a nested stack for the database layer. When updating the stack, the database stack fails with a 'CREATE_FAILED' status, but the parent stack continues updating other resources. What is the most likely cause and best practice to prevent this?
Trap 1: The parent stack was created without the '--capabilities'…
The capabilities parameter is for IAM resources, not related to rollback behavior.
Trap 2: The nested stack failure automatically triggers a rollback of the…
By default, CloudFormation does not roll back the parent stack when a nested stack fails; it continues.
Trap 3: The parent stack is configured with 'OnFailure' set to 'DO_NOTHING'
'DO_NOTHING' is not a valid value; default is 'ROLLBACK' for stack creation but 'CONTINUE' for updates. This is incorrect.
- A
The parent stack's update policy is set to 'CONTINUE' by default. To prevent this, set 'OnFailure' to 'ROLLBACK' in the stack update options.
Setting 'OnFailure' to 'ROLLBACK' during update ensures the entire stack rolls back if any resource fails, maintaining consistency.
- B
The parent stack was created without the '--capabilities' parameter, so it cannot roll back.
Why wrong: The capabilities parameter is for IAM resources, not related to rollback behavior.
- C
The nested stack failure automatically triggers a rollback of the parent stack, but the rollback also failed.
Why wrong: By default, CloudFormation does not roll back the parent stack when a nested stack fails; it continues.
- D
The parent stack is configured with 'OnFailure' set to 'DO_NOTHING'. Change it to 'DELETE'.
Why wrong: 'DO_NOTHING' is not a valid value; default is 'ROLLBACK' for stack creation but 'CONTINUE' for updates. This is incorrect.