How do I set up Time to Live (TTL) in DynamoDB?

1 分的閱讀內容
0

I want to set up Time to Live (TTL) on my Amazon DynamoDB table.

Resolution

Amazon DynamoDB TTL allows you to define a per-item timestamp to determine when an item is no longer needed. After the expiration of the TTL timestamp, TTL typically deletes expired items within a few days. Depending on the size and activity level of a table, the actual delete operation of an expired item can vary.

To set up TTL, see Enabling Time to Live. When you create a TTL attribute in a table, keep the following in mind:

  • TTL attributes must use the Number data type. Other data types, such as String, aren't supported.
  • TTL attributes must use the epoch time format. For example, the epoch timestamp for October 28, 2019 13:12:03 UTC is 1572268323. You can use a free online converter, such as EpochConverter, to get the correct value.
    Note: Be sure that the timestamp is in seconds, not milliseconds (for example, use 1572268323 instead of 1572268323000).

Related information

Expiring items by using DynamoDB Time to Live (TTL)

Tables, items, and attributes

AWS 官方
AWS 官方已更新 7 個月前