A mobile app writes millions of blog posts per day to a DynamoDB table; each post is an item. The app only needs recent posts, and items older than 48 hours can be removed. What is the MOST cost-effective method to automatically delete posts older than 48 hours?
Choose an answer
Tap an option to check your answer.
Correct answer: Add a Number attribute containing the epoch timestamp for 48 hours after creation and enable DynamoDB Time To Live (TTL) using that attribute..
Why this is the answer
DynamoDB Time To Live (TTL) is the most cost-effective and efficient solution for automatically deleting expired items. By adding a Number attribute with the epoch timestamp for 48 hours after creation and enabling TTL, DynamoDB handles the deletions automatically in the background without consuming any write throughput for the deletions themselves. The other options involve custom scripts or Lambda functions that would incur compute costs (EC2, Fargate, Lambda) and consume write capacity units (WCUs) for every deletion, making them less cost-effective and more complex to manage. Using a GSI for deletion is also inefficient as it requires constant querying and manual 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