I am playing with amazon dynamodb no-sql database from past few days and wondering that if there is any feature time to live (TTL) of a item, so that when item reached at that value it automatically deleted from table as per the TTL value, instead of doing manually batch delete item.
Note: Be sure that the timestamp is in seconds, not milliseconds (for example, use 1572268323 instead of 1572268323000).
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, it will delay the expiration. 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.
TTL precisionDynamoDB 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.
Yes, Amazon released the time to live (TTL) feature to DynamoDb in Feb 2017. You just have to go to DynamoDb on your console. Select your table. Then click Overview and enable it there.
The TTL attribute should be your column/attribute that would decide when the row should be expired/deleted.
NOTE: The ttl attribute should be of number datatype(because DynamoDb doesn't support datetime data type). So it should be in EPOCH time format.
For example:
- Linux Terminal: date +%s
- Python: import time; long(time.time())
- Java: System.currentTimeMillis() / 1000L
- JavaScript: Math.floor(Date.now() / 1000)
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