AWS Certified Solutions Architect – Professional (SAP-C02) — Question 86

A company is using AWS CloudFormation to deploy its infrastructure. The company is concerned that, if a production CloudFormation stack is deleted, important data stored in Amazon RDS databases or Amazon EBS volumes might also be deleted.

How can the company prevent users from accidentally deleting data in this way?

Answer options

Correct answer: A

Explanation

The correct answer is A because adding a DeletionPolicy attribute to the resources in the CloudFormation templates ensures that these resources are retained even if the stack is deleted. Option B is incorrect because stack policies do not prevent the deletion of resources with DeletionPolicy attributes. Option C is not effective as IAM policies do not control resource deletion based on tags in this scenario. Option D does not directly address the issue of stack deletion affecting RDS and EBS resources.