‹ All SOA-C02 questions

SOA-C02 Practice Question 6: CloudFormation Deletion Policy

AWS Certified SysOps Administrator – Associate (SOA-C02) · Test 1 · question 6 of 10

Deployment, Provisioning, and Automationmedium

An AWS CloudFormation stack provisions an Amazon RDS DB instance for a test environment. The stack is deleted and recreated regularly as part of the release process. After one deletion the team discovered that all data in the database was gone. They need CloudFormation to preserve a point-in-time copy of the database whenever the stack is deleted, while still allowing the stack to be deleted normally.

What should they add to the template?

Select one answer
Show answer and explanation

Answer:

  • B. Add a DeletionPolicy attribute with a value of Snapshot to the DB instance resource

DeletionPolicy: Snapshot tells CloudFormation to take a final snapshot of the resource before deleting it. It is supported by resource types that can be snapshotted, including AWS::RDS::DBInstance, AWS::RDS::DBCluster, AWS::EC2::Volume, AWS::ElastiCache::CacheCluster, and AWS::Redshift::Cluster. The stack still deletes cleanly, and the snapshot remains after the stack is gone. (DeletionPolicy: Retain would keep the running database itself, which is more than the team asked for.)

Option A prevents the whole stack from being deleted. The stem explicitly requires that deleting the stack still work as part of the release process.

Option C misunderstands stack policies. A stack policy protects resources from being changed or replaced during a stack *update*; it has no effect on a stack delete operation.

Option D is wrong because a DB instance's automated backups are deleted along with the instance. Only manual snapshots (including the final snapshot produced by DeletionPolicy: Snapshot) outlive the database.

Reference: DeletionPolicy attribute

Practice Test 1 ›