Q24 — AWS DVA-C02 Ch.3

Question 24 of 100 | ← Chapter 3

A mobile application stores blog posts in an Amazon DynamoDB table. Several new posts are added daily, each represented as a separate item. The application only requires recent posts. Any post older than 48 hours can be deleted. What is the most cost-effective way to delete posts older than 48 hours?

Correct Answer: D. For each item, add a new Number-type attribute containing a timestamp set to 48 hours after the blog post creation time. Configure the DynamoDB table to use TTL (Time to Live) referencing the new attribute.

Explanation

DynamoDB’s built-in Time-to-Live (TTL) feature is the most cost-effective and operationally efficient solution. By adding a Number-type attribute (epoch timestamp) representing the expiration time (creation time + 48 hours) and enabling TTL on that attribute, DynamoDB automatically deletes expired items without requiring custom code, infrastructure, or polling. Options A, B, and C all involve custom logic, compute resources (EC2, Fargate, Lambda), scheduling, and ongoing maintenance — increasing cost and complexity. TTL incurs no additional charge and scales automatically. Therefore, option D is optimal.