Question #763
A developer is managing an AWS CloudFormation stack deployment. During stack creation or updates, if a resource provisioning failure occurs, the developer must ensure that any successfully provisioned resources are retained. The solution must use the AWS CLI for stack operations. Which command line options will meet these requirements?
Add an --on-failure DO_NOTHING command line option to the create-stack command and the update-stack command.
Add a --disable-rollback command line option to the create-stack command and the update-stack command.
Add a --retain-resources RESOURCELOGICALID command line option to the create-stack command and the update-stack command.
Add an --enable-termination-protection command line option to the create-stack command and the update-stack command.
Explanation
Option B is correct because the --disable-rollback flag in the create-stack command instructs AWS CloudFormation to retain any successfully provisioned resources if a failure occurs during stack creation. This meets the requirement to retain resources on failure. For updates, CloudFormation automatically rolls back changes by default if an error occurs, but there is no CLI option to disable rollback for updates. However, since the question emphasizes using the AWS CLI and the other options are incorrect:
- Option A's --on-failure DO_NOTHING applies only to EC2 instances, not stacks.
- Option C's --retain-resources is used during stack deletion, not creation/updates.
- Option D's termination protection prevents stack deletion but doesn't affect rollback behavior.
Thus, B is the only valid CLI-based solution for retaining resources during creation, aligning with the question's key points.
Answer
The correct answer is: B