DOP-C02 Practice Question 53: CFN Deletion Replace Policy

AWS Certified DevOps Engineer – Professional (DOP-C02) · Test 6 · question 3 of 10

Configuration Management and IaCmedium

A CloudFormation template provisions a production RDS DB instance. Operators need two independent guarantees for that resource. First, if a future stack update ever forces CloudFormation to replace the DB instance, the old instance must not be deleted; it should remain intact so it can still be inspected. Second, if the stack itself is ever deleted, CloudFormation must take a final DB snapshot before removing the instance rather than deleting it outright.

Which combination of resource attributes on the DB instance satisfies both requirements?

Select one answer
Show answer and explanation

Answer:

  • A. Set DeletionPolicy to Snapshot and UpdateReplacePolicy to Retain on the DB instance resource

DeletionPolicy controls what CloudFormation does to a resource when the resource is removed because the stack is deleted; Snapshot is supported for resources such as RDS DB instances, EBS volumes, ElastiCache clusters and Redshift clusters, and it takes a final snapshot before deleting the underlying resource. UpdateReplacePolicy controls a different event: what happens to the old resource when a stack update forces CloudFormation to replace it with a new one; Retain keeps the old resource around instead of deleting it. Setting DeletionPolicy: Snapshot together with UpdateReplacePolicy: Retain covers both requirements independently.

Option B swaps the two policies: DeletionPolicy: Retain would leave the instance running forever on stack deletion with no snapshot taken, and UpdateReplacePolicy: Snapshot is not a valid combination for satisfying the stated requirement of keeping the old instance intact.

Option C is wrong because UpdateReplacePolicy defaults to Delete, not Retain; CloudFormation deletes a replaced resource unless UpdateReplacePolicy is explicitly set, so it must be specified.

Option D only addresses accidental deletion of the whole stack through the console or CLI; termination protection does not create a snapshot. For a standalone DB instance the default DeletionPolicy is already Snapshot, but nothing sets UpdateReplacePolicy, which defaults to Delete, so an update that forces replacement still deletes the old instance without a snapshot.

Reference: DeletionPolicy attribute

Practice Test 6 ›

Study guides for DOP-C02

AWS Service Control Policies Explained: SCPs and DenialsAWS service control policies explained: how SCPs cap permissions, why admins still get access denied, inheritance, deny vs allow lists and the exam traps.
How AI Is Changing Software Jobs: Where to PrepareHow AI is changing software jobs: what history shows, the evidence on junior developers, what Klarna learned, new AI roles and five domains to prepare for.
How AWS Certification Exams Work: Scoring and RenewalHow AWS certification exams work: levels, booking, question types, unscored questions, scaled scores, pass marks, validity and how recertification works.
What Is Amazon RDS? Multi-AZ, Read Replicas and BackupsWhat is Amazon RDS? Engines, Multi-AZ, read replicas, backups, RDS Proxy, Aurora and pricing explained, with the traps that AWS exams set around each one.
Best DevOps certification: AWS, Azure, Google or CKAThe best DevOps certification for your stack: AWS DOP-C02, Azure AZ-400, Google Cloud DevOps Engineer and CKA compared on cost, level and prerequisites.
What Is AWS Lambda? Triggers, Concurrency and Cold StartsWhat is AWS Lambda? How functions run, cold starts, triggers vs event source mappings, concurrency, layers, aliases, pricing and the exam traps.
AWS CloudOps Engineer Associate (SOA-C03) exam guideAWS Certified CloudOps Engineer – Associate (SOA-C03) replaced SysOps Administrator. Format, cost, the five domains, what changed and how to prepare.
Which AWS certification should you get? 2026 roadmapWhich AWS certification to get first, by role and experience, with each exam's status in October 2026, what is changing, and prices in USD and INR.
What Is Amazon EC2? Instances, AMIs, EBS and Auto ScalingAmazon EC2 explained: instances, AMIs, instance types, security groups, EBS, Auto Scaling groups and pricing options, with the traps AWS exams set.
SQS vs SNS vs EventBridge on AWSWhen to use an SQS queue, an SNS topic or an EventBridge bus, plus fan-out, FIFO ordering, visibility timeouts and dead-letter queues for AWS exams.