Courseiva
Deployment, Provisioning, and AutomationhardMultiple ChoiceObjective-mapped

SOA-C02 Practice Question: CloudFormation stack policy to prevent accidental…

A CloudFormation stack manages an RDS database, an S3 bucket, and several Lambda functions. During a recent stack update, a property change caused CloudFormation to replace the RDS instance, deleting the database and re-creating it — resulting in data loss. The team wants to prevent any future stack update from replacing or deleting the RDS instance without an explicit override. What CloudFormation feature accomplishes this?

⚠ Common exam trap

Many candidates confuse RDS deletion protection or DeletionPolicy: Retain with stack policies, mistakenly believing those features can block CloudFormation from replacing a resource during an update, when in fact they only protect against deletion in specific scenarios (e.g., stack deletion or direct API calls).

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

Set a stack policy that denies Replace and Delete actions on the RDS resource; require an override policy to be explicitly provided when a replacement is intentional

A CloudFormation stack policy can explicitly deny Update (which includes replacement) and Delete actions on specific resources, such as the RDS instance. To intentionally perform a replacement, the user must provide an override stack policy during the update that allows the action, ensuring that no accidental replacement occurs without explicit consent.

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 a stack policy that denies Replace and Delete actions on the RDS resource; require an override policy to be explicitly provided when a replacement is intentional

    Why this is correct

    The stack policy evaluates each update action per resource. A Deny on Replace for the RDS logical resource ID prevents CloudFormation from completing any update that would recreate the database — the update fails with a clear policy error. A temporary override policy passed via --stack-policy-during-update can explicitly allow the replacement for a deliberate migration.

  • Enable deletion protection on the RDS instance to prevent CloudFormation from deleting it

    Why it's wrong here

    RDS deletion protection prevents accidental deletion through the API or console, and also causes CloudFormation delete-stack to fail for that resource. However, deletion protection does not prevent CloudFormation from replacing the instance (replacing creates a new instance and deletes the old one). A stack policy must be used to block the Replace action.

  • Use CloudFormation change sets to preview the update and manually reject any change set that includes a replacement

    Why it's wrong here

    Change sets allow previewing before executing, which is good practice. However, if the operator forgets to review or a CI/CD pipeline applies the change set automatically, the replacement can still occur. A stack policy enforces the protection automatically without relying on human review.

  • Add a DeletionPolicy: Retain attribute to the RDS resource in the template

    Why it's wrong here

    DeletionPolicy: Retain prevents CloudFormation from deleting the physical resource when the logical resource is removed from the stack or the stack is deleted. It does not prevent CloudFormation from replacing the resource due to a property change during a stack update — that is controlled by the UpdateReplacePolicy attribute (also Retain) and the stack policy.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

Courseiva writes every SOA-C02 question from scratch — 247 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SOA-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 SOA-C02 exam.