DVA-C02 Development with AWS Services Practice Question
A company is using AWS CloudFormation to deploy infrastructure. The developer needs to update a stack but wants to avoid downtime for a critical database. Which THREE strategies should the developer consider?
⚠ Common exam trap
Many exam-takers confuse `DeletionPolicy: Retain` (which only protects against accidental stack deletion) with a mechanism that prevents downtime during updates, when in fact it does nothing to manage the update lifecycle.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use the UpdateReplace policy to create a new resource before deleting the old one.
The `UpdateReplace` policy (specifically using a `CreationPolicy` and `UpdatePolicy` with `AutoScalingReplacingUpdate`) instructs CloudFormation to create a replacement resource before deleting the original, ensuring zero downtime during a stack update that requires resource replacement. This is critical for a database where continuous availability is required.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Set the DeletionPolicy attribute to Retain on the database resource.
Why it's wrong here
Setting the DeletionPolicy attribute to Retain on a database resource instructs CloudFormation to preserve the resource when its containing stack is deleted, or when the resource is removed from the template. However, DeletionPolicy does not prevent CloudFormation from replacing a resource during a stack update if a property change requires a new physical resource. If a database property is updated in a way that triggers replacement, CloudFormation will still attempt to create a new database and then delete the old one, unless other update policies are specifically applied.
- ✗
Use the Parameters section to set a conditional update flag.
Why it's wrong here
The Parameters section in a CloudFormation template is designed to accept input values at stack creation or update time, allowing for template customization without direct modification. While parameters can influence resource properties, they do not inherently provide a mechanism to control or prevent specific update behaviors, such as resource replacement or modification. There is no built-in CloudFormation functionality where a parameter can act as a 'conditional update flag' to alter the update strategy of a resource.
- ✓
Use the UpdateReplace policy to create a new resource before deleting the old one.
Why this is correct
The UpdateReplacePolicy attribute, when applied to a resource like a database, allows CloudFormation to create a new resource instance before deleting the old one if a property change necessitates replacement. By setting this policy to `Retain` or `Snapshot` (for snapshot-capable resources), CloudFormation ensures the new resource is successfully provisioned and potentially populated or integrated before the original resource is terminated. This strategy significantly minimizes downtime and reduces the risk of data loss during critical database updates, maintaining service continuity.
- ✓
Apply a stack policy that prevents updates to the database resource.
Why this is correct
Applying a stack policy is a robust method to prevent unintended updates to critical resources within a CloudFormation stack. A stack policy is a JSON document that defines explicit allow or deny rules for update actions, such as `Update:Replace` or `Update:Modify`, on specific resources. By configuring a stack policy to deny replacement or modification actions on the database resource, an administrator can safeguard against accidental changes that could lead to downtime or data corruption, providing a strong governance layer.
- ✓
Use change sets to review the impact of changes before executing them.
Why this is correct
CloudFormation change sets provide a crucial preview mechanism, detailing exactly how a proposed template update will impact existing stack resources before any changes are applied. For critical resources like databases, a change set clearly identifies whether a resource will be added, modified, or, most importantly, replaced. This allows developers to review the potential consequences, identify unintended database replacements, and adjust the template or plan accordingly, thereby mitigating risks and preventing unexpected downtime or data loss.
Go deeper
Related to this question
About these practice questions
One of 1,135 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.