A CloudFormation-managed stack creates EC2 instances. The administrator wants the instances and their data to persist even if someone deletes the CloudFormation stack. Which CloudFormation configuration meets this requirement?
Choose an answer
Tap an option to check your answer.
Correct answer: Set the EC2 resource's DeletionPolicy attribute to Retain in the template..
Why this is the answer
Setting the DeletionPolicy attribute to Retain for the EC2 instance resource in the CloudFormation template ensures that the instance and its associated data volumes are preserved when the CloudFormation stack is deleted. CloudFormation will not terminate the instance, allowing it to continue running independently. Setting DeletionPolicy to Snapshot would create a snapshot of the instance's volumes before deletion, but the instance itself would still be terminated. Using Amazon Data Lifecycle Manager or AWS Backup are valid backup strategies, but they don't directly prevent CloudFormation from deleting the EC2 instance itself when the stack is deleted; they only ensure data recoverability. The core requirement is for the instance and its data to persist, which Retain directly addresses for the instance.
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