DVA-C02 · Question #335
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 r
The correct answer is D. Enable TTL on the DynamoDB table and specify the expiration_date attribute. Expire old user. DynamoDB TTL automatically deletes items whose epoch timestamp attribute has passed, requiring no custom code or scheduling.
Question
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?
Options
- ACreate an AWS Lambda function to delete old user responses based on the expiration_date
- BCreate an AWS Fargate task in Amazon Elastic Container Service (Amazon ECS) to delete old
- CCreate an AWS Glue job to delete old user responses based on the expiration_date attribute.
- DEnable TTL on the DynamoDB table and specify the expiration_date attribute. Expire old user
How the community answered
(41 responses)- A10% (4)
- B2% (1)
- C7% (3)
- D80% (33)
Why each option
DynamoDB TTL automatically deletes items whose epoch timestamp attribute has passed, requiring no custom code or scheduling.
A Lambda function requires writing deletion logic, setting up an EventBridge schedule, and managing IAM permissions, which is significantly more development effort than enabling TTL.
A Fargate task involves provisioning a container, writing deletion code, scheduling the task, and managing the ECS infrastructure, which is the highest development effort option.
An AWS Glue job requires authoring an ETL script, configuring a Glue job, and scheduling it, adding unnecessary complexity compared to native TTL.
Enabling TTL on the DynamoDB table and designating expiration_date as the TTL attribute instructs DynamoDB to automatically delete items once the Unix epoch time stored in that attribute is reached. This is a fully managed, zero-code feature that requires only a table configuration change, making it the lowest-effort solution.
Concept tested: DynamoDB Time to Live (TTL) for automatic item expiration
Source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html
Community Discussion
No community discussion yet for this question.