A team uses one CloudFormation template to deploy web servers and an RDS database across environments. After an accidental deployment, the development database was dropped and recreated, causing data loss. Which actions will prevent accidental deletion of the database in the future? (Select two.)
Choose an answer
Tap an option to check your answer.
Correct answer: Add a CloudFormation DeletionPolicy attribute with the value Retain to the database resource., Update the CloudFormation stack policy to block updates to the database resource..
Why this is the answer
Adding a DeletionPolicy attribute with Retain to the database resource prevents CloudFormation from deleting the database when the stack is deleted or the resource is removed from the template. Instead, the database will remain, preventing data loss. Updating the CloudFormation stack policy to block updates to the database resource prevents unintended modifications or deletions of the database, even if the CloudFormation template is updated to remove it. This provides an additional layer of protection. Converting to Multi-AZ improves availability but doesn't prevent accidental deletion. Using a stack set is for deploying to multiple accounts/regions, not for preventing accidental deletion. Applying DeletionPolicy: Retain to the entire stack would prevent the entire stack from being deleted, which is overly broad and not specific to protecting only the database.
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