Jeff’s Note #
Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.
For AWS DVA-C02 candidates, the confusion often lies in understanding how CloudFormation handles resource rollbacks on stack failures and ensuring that some resources are preserved. In production, this is about knowing exactly which CLI flags to use to disable rollback and prevent resource deletion after errors during stack creation or updates. Let’s drill down.
The Certification Drill (Simulated Question) #
Scenario #
Nova Apps Inc., a SaaS startup, uses AWS CloudFormation to automate the provisioning of their entire infrastructure. A lead developer is tasked with scripting the stack deployment and update processes using the AWS CLI. The developer needs to ensure that if the stack creation or update fails due to an error in the template or resource provisioning, the stack does not roll back and delete already created resources, preserving them for further investigation and recovery.
The Requirement: #
Which AWS CLI option or parameter should the developer use during the create-stack and update-stack commands to meet the requirement of preserving successfully provisioned resources when an error occurs?
The Options #
- A) Add an
--enable-termination-protectionoption to thecreate-stackandupdate-stackcommands. - B) Add a
--disable-rollbackoption to thecreate-stackandupdate-stackcommands. - C) Add a
--parameters ParameterKey=PreserveResources,ParameterValue=Trueoption to thecreate-stackandupdate-stackcommands. - D) Add a
--tags Key=PreserveResources,Value=Trueoption to thecreate-stackandupdate-stackcommands.
Google adsense #
leave a comment:
Correct Answer #
B
Quick Insight: The Developer Imperative #
The
--disable-rollbackCLI flag instructs CloudFormation not to revert any successfully created resources during stack failures. This is critical in debugging and retaining partial deployments in production. Termination protection prevents stack deletion but does not disable rollback on creation/update failure. Parameter and tag options do not influence rollback behavior.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option B
The Winning Logic #
The --disable-rollback flag disables the automatic rollback of all successfully created or updated resources when an error happens during stack operations. This means the stack remains in its failed state but preserves any resources created up to the point of failure. This is invaluable for troubleshooting issues and preserving resources for manual fixes, backups, or recovery steps.
- When this flag is not set, CloudFormation performs a rollback on failures by default, deleting all created resources to avoid partial states.
- This flag is applicable to both
create-stackandupdate-stackcommands in the AWS CLI. - Termination protection, option A, prevents the stack from being deleted manually or via API but does NOT affect rollback behavior during creation/updating.
- Option C and D involve custom parameters or tags that do not affect CloudFormation’s rollback logic.
The Trap (Distractor Analysis): #
- Why not A?) Termination protection safeguards against stack deletion but does not stop rollback on failed creation or update operations. So resources get deleted anyway if rollback is enabled.
- Why not C?) Parameters with keys like
PreserveResourcesare arbitrary and have no predefined effect on CloudFormation rollback behavior. - Why not D?) Tags similarly do not influence rollback or stack failure handling; they are metadata only.
The Technical Blueprint #
# Correct AWS CLI commands to disable rollback on stack creation and update
aws cloudformation create-stack \
--stack-name MyStack \
--template-body file://template.yaml \
--disable-rollback \
--parameters ParameterKey=KeyName,ParameterValue=MyKeyPair
aws cloudformation update-stack \
--stack-name MyStack \
--template-body file://template.yaml \
--disable-rollback
The Comparative Analysis #
| Option | API Behavior Complexity | Effect on Rollback | Use Case |
|---|---|---|---|
| A | Simple | No effect | Prevents deletion from manual stack delete calls only |
| B | Simple | Disables rollback | Preserves resources on create/update failures |
| C | None (custom) | No effect | No CloudFormation impact |
| D | Metadata only | No effect | No CloudFormation impact |
Real-World Application (Practitioner Insight) #
Exam Rule #
For the exam, always pick --disable-rollback when you see the requirement to preserve partially created resources after stack failures.
Real World #
In production, teams might disable rollback during testing or debugging stack templates to analyze failed resources. However, disabling rollback in production stacks without strong automated cleanup can lead to orphaned resources causing cost and security issues. Use with caution.
(CTA) Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the AWS DVA-C02 exam.