A company runs an application on many Amazon EC2 instances that read and write to a continuously growing Amazon DynamoDB table. The application needs data only from the last 30 days. The company wants the lowest cost and minimal development effort. Which solution meets these requirements?
Choose an answer
Tap an option to check your answer.
Correct answer: Extend the application to add an attribute that has a value of the current timestamp plus 30 days to each new item that is created in the table. Configure DynamoDB to use the attribute as the TTL attribute..
Why this is the answer
The correct solution leverages DynamoDB's Time To Live (TTL) feature. By adding an attribute to each item that stores the expiration timestamp (current time + 30 days) and configuring DynamoDB to use this attribute as the TTL attribute, DynamoDB automatically deletes expired items. This is the most cost-effective and lowest-effort solution as it requires minimal application changes and offloads the deletion logic to DynamoDB. Using CloudFormation to redeploy and delete stacks every 30 days is overly complex and disruptive for continuous data management. An EC2 instance running a monitoring application and a script for deletion introduces unnecessary compute costs and management overhead. Using DynamoDB Streams to invoke a Lambda function for deletion would incur Lambda execution costs and requires managing the Lambda function, making it more expensive and complex than DynamoDB TTL.
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