An application reads items from a DynamoDB table where each item has an expirationDate timestamp attribute. The application finds items by this timestamp to archive and then delete them. The application will be retired soon, and the developer needs a low-code replacement for this behavior. Which approach requires the least amount of new code?
Choose an answer
Tap an option to check your answer.
Correct answer: Enable DynamoDB TTL on the expirationDate attribute. Enable a DynamoDB stream and create a Lambda, triggered by the stream, to process the deleted items..
Why this is the answer
The correct option leverages DynamoDB's built-in Time To Live (TTL) feature, which automatically deletes items after a specified timestamp. This is a low-code solution for the deletion aspect. By enabling a DynamoDB Stream, every item deleted by TTL will generate a record in the stream. A Lambda function can then be triggered by this stream to process the deleted items, fulfilling the archiving requirement with minimal custom code. The other options involve more custom code or less efficient mechanisms. Creating two Lambdas to manually delete and process items (second and third options) requires writing and managing deletion logic, which TTL handles automatically. Using an SQS dead-letter queue as a TTL target (fourth option) is not a standard or direct way to process TTL-deleted items; TTL directly integrates with DynamoDB Streams for processing.
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