A company caches session data in a DynamoDB table and wants an automated way to remove expired session items. What is the simplest way to automatically delete old items?
Choose an answer
Tap an option to check your answer.
Correct answer: Add an attribute containing the expiration time and enable DynamoDB Time To Live (TTL) using that attribute..
Why this is the answer
DynamoDB Time To Live (TTL) is the simplest and most cost-effective way to automatically delete expired items from a DynamoDB table. You define a TTL attribute (e.g., expirationTime) in your table, which stores a timestamp indicating when an item should no longer be retained. DynamoDB then automatically deletes items with an expired TTL attribute, freeing up storage and reducing costs without consuming write capacity. Writing a script for deletion is more complex, requires managing an EC2 instance, and consumes write capacity. Creating a new table daily is inefficient and complicates data retrieval. Adding an ItemExpiration attribute without enabling TTL does not automatically delete items; it only stores the expiration time.
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