Dynamodb easy
You have a high-volume 'Audit logs' table where entries only need to persist for 90 days. What is the most cost-effective way to manage this?
- A Run a nightly scheduled Lambda function that scans and deletes old rows.
- B Enable TTL on a timestamp attribute; DynamoDB will automatically delete expired items in the background at no extra RCU/WCU cost.
- C Delete the entire table and recreate it every 3 months.
- D Manually delete items via the AWS Console when the storage bill gets too high.
Answer: B. Enable TTL on a timestamp attribute; DynamoDB will automatically delete expired items in the background at no extra RCU/WCU cost.
TTL is 'Free' cleanup. By identifying a timestamp attribute, DynamoDB marks expired items for deletion. This deletion is asynchronous and doesn't consume your provisioned throughput units, making it perfect for temporary session data or logs.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- DynamoDB has a strict 400KB limit on the size of a single item. What is the recommended design pattern if you need to store larger documents (e.g., 5MB PDFs)?
- What is the primary role of the 'Partition Key' in ensuring DynamoDB's infinite horizontal scalability?
- Why is the `Query` operation generally preferred over `Scan` for production workloads in DynamoDB?
- DynamoDB is a 'fully managed' serverless database. What is a primary operational benefit of this model for an engineering team?
- In 'Provisioned Capacity' mode, how is the performance budget of a DynamoDB table defined?
- When would an architect choose to implement DAX (DynamoDB Accelerator) in front of an existing DynamoDB table?