A team deploys web servers and an Amazon RDS database from a single CloudFormation template across multiple environments. A recent accidental deployment caused the primary development database to be deleted and recreated, losing data. Which actions will prevent accidental deletion of the database in future deployments? (Choose two.)
Choose an answer
Tap an option to check your answer.
Correct answer: Add a DeletionPolicy attribute with the value Retain to the database resource in the CloudFormation template., Update the CloudFormation stack policy to block changes to the database resource..
Why this is the answer
Adding a DeletionPolicy attribute with the value Retain to the database resource ensures that CloudFormation does not delete the database when the stack is deleted or the resource is removed from the template. Instead, the database resource is retained, preventing data loss. Updating the CloudFormation stack policy to block changes to the database resource provides an additional layer of protection. A stack policy defines which resources within a stack can be updated or deleted, preventing unintended modifications or deletions of critical resources like a production database. Converting the database to Multi-AZ enhances availability but does not prevent accidental deletion. Deploying with StackSets is for managing multiple stacks across accounts/regions and doesn't directly address accidental deletion. Applying DeletionPolicy: Retain to the entire stack would prevent the entire stack from being deleted, which is overly broad and not the specific problem.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed