DVA-C02 · Question #289
A developer supports an application that accesses data in an Amazon DynamoDB table. One of the item attributes is expirationDate in the timestamp format. The application uses this attribute to find…
The correct answer is A. Enable TTL on the expirationDate attribute in the table. Create a DynamoDB stream. Create an. Option A is correct because enabling DynamoDB TTL on the expirationDate attribute handles item deletion automatically with zero code - DynamoDB compares the timestamp to the current time and deletes expired items natively. Pairing this with a DynamoDB Stream allows a single…
Question
A developer supports an application that accesses data in an Amazon DynamoDB table. One of the item attributes is expirationDate in the timestamp format. The application uses this attribute to find items, archive them, and remove them from the table based on the timestamp value. The application will be decommissioned soon, and the developer must find another way to implement this functionality. The developer needs a solution that will require the least amount of code to write. Which solution will meet these requirements?
Options
- AEnable TTL on the expirationDate attribute in the table. Create a DynamoDB stream. Create an
- BCreate two AWS Lambda functions: one to delete the items and one to process the items. Create
- CCreate two AWS Lambda functions: one to delete the items and one to process the items. Create
- DEnable TTL on the expirationDate attribute in the table. Specify an Amazon Simple Queue
How the community answered
(21 responses)- A81% (17)
- B10% (2)
- C5% (1)
- D5% (1)
Explanation
Option A is correct because enabling DynamoDB TTL on the expirationDate attribute handles item deletion automatically with zero code - DynamoDB compares the timestamp to the current time and deletes expired items natively. Pairing this with a DynamoDB Stream allows a single Lambda function to capture the TTL-deletion events and archive the items, fulfilling all requirements with minimal code.
Options B and C are wrong because they require two Lambda functions - one to handle deletion and one to process/archive - meaning the developer must write custom deletion logic that TTL already provides for free. Options B and C essentially replicate work DynamoDB can do natively.
Option D is wrong because routing through SQS adds an unnecessary layer: you'd need code to populate the queue and consume it, which is more code than a direct Stream-to-Lambda pipeline.
Memory tip: Think of TTL as DynamoDB's built-in "self-destruct timer" - whenever you see expiration + least code, TTL is almost always the answer. DynamoDB Streams are the natural companion when you need to react to those deletions (e.g., archive before they disappear).
Topics
Community Discussion
No community discussion yet for this question.