Table of Contents
hide
DynamoDB Time to Live – TTL
- DynamoDB Time to Live – TTL enables a per-item timestamp to determine when an item is no longer needed.
- After the date and time of the specified timestamp, DynamoDB deletes the item from the table without consuming any write throughput.
- DynamoDB TTL is provided at no extra cost and can help reduce data storage by retaining only required data.
- Items that are deleted from the table are also removed from any local secondary index and global secondary index in the same way as a DeleteItem operation.
- Expired items get removed from the table and indexes within about 48 hours.
- DynamoDB Stream tracks the delete operation as a system delete, not a regular one.
- TTL requirements
- TTL attributes must use the Number data type. Other data types, such as String, aren’t supported.
TTL attributes must use the epoch time format.- Be sure that the timestamp is in seconds, not milliseconds
- TTL attributes must use the Number data type. Other data types, such as String, aren’t supported.
- TTL is useful if the stored items lose relevance after a specific time. for e.g.
- Remove user or sensor data after a year of inactivity in an application
- Archive expired items to an S3 data lake via DynamoDB Streams and AWS Lambda.
- Retain sensitive data for a certain amount of time according to contractual or regulatory obligations.
AWS Certification Exam Practice Questions
- Questions are collected from Internet and the answers are marked as per my knowledge and understanding (which might differ with yours).
- AWS services are updated everyday and both the answers and questions might be outdated soon, so research accordingly.
- AWS exam questions are not updated to keep up the pace with AWS updates, so even if the underlying feature has changed the question might not be updated
- Open to further feedback, discussion and correction.
- A company developed an application by using AWS Lambda and
Amazon DynamoDB. The Lambda function periodically pulls data from the company’s S3 bucket based on date and time tags and inserts specific values into a DynamoDB table for further processing. The company must remove data that is older than 30 days from the DynamoDB table. Which solution will meet this requirement with the MOST operational efficiency?- Update the Lambda function to add the Version attribute in the DynamoDB table. Enable TTL on the DynamoDB table to expire entries that are older than 30 days based on the TTL attribute.
- Update the Lambda function to add the TTL attribute in the DynamoDB table. Enable TTL on the DynamoDB table to expire entries that are older than 30 days based on the TTL attribute.
- Use AWS Step Functions to delete entries that are older than 30 days.
- Use EventBridge to schedule the Lambda function to delete entries that are older than 30 days.