A serverless application was deployed into a production VPC using AWS CloudFormation. The stack includes a Lambda function, a DynamoDB table, and an API Gateway. The administrator needs to delete the CloudFormation stack but keep the DynamoDB table intact. What should be done before deleting the stack?
Choose an answer
Tap an option to check your answer.
Correct answer: Apply a Retain deletion policy to the DynamoDB logical resource in the CloudFormation template..
Why this is the answer
The correct approach is to apply a Retain deletion policy to the DynamoDB logical resource in the CloudFormation template. This policy ensures that when the CloudFormation stack is deleted, the specified resource (the DynamoDB table in this case) is not deleted and remains in your AWS account. This is a standard and intended use of CloudFormation deletion policies for preserving data. Applying a Snapshot deletion policy is incorrect because it would create a snapshot of the DynamoDB table before deletion, but the table itself would still be deleted. Turning on termination protection for the CloudFormation stack is incorrect because it prevents the stack from being deleted, not individual resources within it. Modifying the application's IAM policy to deny dynamodb:DeleteTable is an indirect and unreliable method; CloudFormation operates with its own service role permissions, and this approach doesn't guarantee the table's preservation during a stack deletion.
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