Working With DynamoDB TTL
Time To Live (TTL) for DynamoDB allows you to define when items in a table expire so that they can be automatically deleted from the database.
- For enabling TTL, first thing we need is an Attribute on which TTL will work
- So Attribute, we will one more field to items which we wanna delete
Lets name the Attribute as DeletionTime, this TTL Attribute value should be in epoch time format
So for this example we wanna delete item with Rank 4 on 25th August 2020
Epoch time for 25th August 2020 would be 1593109297, lets input this to our table
- Next we need to enable TTL by going to Action > Manage TTL
- Enter TTL attribute as DeletionTime as added in our item
- That’s it, we have successfully enable TTL once its 25th August 2020 our item would deleted
- You can try date of your choice in epoch format, don’t be waiting till 2020 😛