AWS Certified Developer – Associate (DVA-C02) — Question 260
A company runs its website on AWS. The company posts daily polls on its website and publishes the poll results next day. The website stores user responses in an Amazon DynamoDB table. After the poll results are published, the company does not need to keep the user responses.
A developer needs to implement a solution that will automatically remove old user responses from the DynamoDB table. The developer adds a new expiration_date attribute to the DynamoDB table. The developer plans to use the expiration_date attribute for the automation.
Which solution will meet these requirements with the LEAST development effort?
Answer options
- A. Create an AWS Lambda function to delete old user responses based on the expiration_date attribute. Create an Amazon EventBridge schedule to run the Lambda function daily.
- B. Create an AWS Fargate task in Amazon Elastic Container Service (Amazon ECS) to delete old user responses based on the expiration_date attribute. Create an Amazon EventBridge schedule to run the Fargate task daily.
- C. Create an AWS Glue job to delete old user responses based on the expiration_date attribute. Create an AWS Glue trigger schedule to run the job daily.
- D. Enable TTL on the DynamoDB table and specify the expiration_date attribute. Expire old user responses by using DynamoDB TTL.
Correct answer: D
Explanation
The correct answer is D because enabling TTL (Time to Live) on the DynamoDB table allows for automatic deletion of items after the specified expiration date without additional development work. The other options involve creating separate processes (Lambda, Fargate, or Glue) that require additional coding and management, making them less efficient compared to the built-in TTL feature.