AWS Certified Developer – Associate (DVA-C02) — Question 202
A developer is setting up infrastructure by using AWS CloudFormation. If an error occurs when the resources described in the Cloud Formation template are provisioned, successfully provisioned resources must be preserved. The developer must provision and update the CloudFormation stack by using the AWS CLI.
Which solution will meet these requirements?
Answer options
- A. Add an --enable-termination-protection command line option to the create-stack command and the update-stack command.
- B. Add a --disable-rollback command line option to the create-stack command and the update-stack command.
- C. Add a --parameters ParameterKey=PreserveResources,ParameterValue=True command line option to the create-stack command and the update-stack command.
- D. Add a --tags Key=PreserveResources,Value=True command line option to the create-stack command and the update-stack command.
Correct answer: B
Explanation
The correct answer is B because using the --disable-rollback option allows the stack creation or update to continue even if an error occurs, preserving already provisioned resources. Option A is incorrect as enable-termination-protection does not prevent rollback on errors. Options C and D do not address error handling during stack creation and will not preserve resources in the event of a failure.