AWS Developer DVA-C02 · Deployment · easy

An AWS CloudFormation stack provisions an Amazon RDS production database and an Amazon S3 audit bucket. If a junior engineer accidentally deletes the CloudFormation stack, the company wants the RDS database to have a final snapshot taken automatically before termination, and the S3 bucket to be kept intact without being deleted. Which DeletionPolicy values should be set on the RDS instance and the S3 bucket in the CloudFormation template?

Published · Last updated · checked before publication — how we verify questions

Options

  • ASet DeletionPolicy: Delete on both the RDS instance and the S3 bucket
  • BSet DeletionPolicy: Snapshot on RDS and DeletionPolicy: Retain on S3Correct answer
  • CSet DeletionPolicy: Snapshot on S3 and DeletionPolicy: Delete on RDS
  • DSet UpdateReplacePolicy: Delete with no DeletionPolicy on either resource

Answer: B. Set DeletionPolicy: Snapshot on RDS and DeletionPolicy: Retain on S3

In CloudFormation, setting DeletionPolicy: Snapshot on resources that support snapshots (such as AWS::RDS::DBInstance, AWS::EC2::Volume, AWS::Redshift::Cluster) creates a final snapshot before deleting the resource, while setting DeletionPolicy: Retain preserves the resource (AWS::S3::Bucket) in your AWS account when the stack is deleted.

Why the other options are wrong

  • A. Set DeletionPolicy: Delete on both the RDS instance and the S3 bucket — DeletionPolicy: Delete permanently destroys the RDS database (unless DeleteAutomatedBackups/snapshot is set) and fails or deletes the bucket.
  • C. Set DeletionPolicy: Snapshot on S3 and DeletionPolicy: Delete on RDS — AWS::S3::Bucket does not support DeletionPolicy: Snapshot (only Delete, Retain, or RetainExceptOnCreate).
  • D. Set UpdateReplacePolicy: Delete with no DeletionPolicy on either resource — Omitting DeletionPolicy defaults to Delete when the stack is deleted.

All Deployment questions and the topic overview →

AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.