Reputation: 130
In order to maintain the size of a Dynamodb acceptable. I need to have a triggerable and periodic way of purging the database. It seems that Amazon DynamoDB supports a BatchWriteItem action for deleting multiple items at the same time. What's the best way to do it?
Upvotes: 0
Views: 224
Reputation: 46859
Have you considered using the built-in TTL feature:
Time to Live (TTL) for Amazon DynamoDB lets you define when items in a table expire so that they can be automatically deleted from the database. With TTL enabled on a table, you can set a timestamp for deletion on a per-item basis, allowing you to limit storage usage to only those records that are relevant.
TTL is useful if you have continuously accumulating data that loses relevance after a specific time period (for example, session data, event logs, usage patterns, and other temporary data). If you have sensitive data that must be retained only for a certain amount of time according to contractual or regulatory obligations, TTL helps you ensure that it is removed promptly and as scheduled.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html
Upvotes: 2