I have a requirement to expire items with different time to live configuration. There are cases where items in table won't expire of certain cases as well. In Cassandra we can set time-to-live while writing at the record level. In DynamoDB I could only see the TimeToLive configuration at table level (I could be wrong too.) but not at item level.
If there is no possibility to set TTL at item level, i would like to fall back to second option.
Sign in to the AWS Management Console and open the DynamoDB console at https://console.aws.amazon.com/dynamodb/ . Choose Tables, and then choose the table that you want to modify. In the Additional settings tab, in the Time to Live (TTL) section, choose Enable.
Yes according to the link you sent. DynamoDB typically deletes expired items within 48 hours of expiration. The exact duration within which an item truly gets deleted after expiration is specific to the nature of the workload and the size of the table.
The key statement, as you pointed out, is at How It Works: DynamoDB Time to Live (TTL): Items that are past their expiration, but have not yet been deleted can still be updated, and successful updates to change or remove the expiration attribute will be honored.
DynamoDB can absolutely do this on the item level in the table. In the table level configurations is where you tell DynamoDB the name of the attribute that will contain the value for the TTL. This attribute name can be whatever you want. Then on each item you write to the table, you include an attribute named what you told DynamoDB to look for with the value in epoch time format in seconds. Once you do that, when that item's time comes, DynamoDB will lazy delete the item in 24-48 hours. Best of all, that delete is of no cost to you.
For more information on how to enable TTL go here. For more about how TTL works, go here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With