Skip to content

Max TTL for DynamoDB

0

Hi DynamoDB Team,

I am working on setting up a TTL for an DynamoDB Table that holds important information for accounting purposes. The recommended approach is to implement a TTL set for 10 years when creating the entries. I am curious whether there is a max epoch time value that we can put for this TTL. I would assume there is not but I just want to double check.

Thanks, Matt

asked a year ago775 views

2 Answers
2

There is no maximum time in the future that you can use as a TTL value, however there is a limit that it can't be more than 5 years in the past.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/time-to-live-ttl-before-you-start.html

AWS
EXPERT

answered a year ago

0

For DynamoDB's Time To Live (TTL) feature, there is a limitation on how far in the past the TTL value can be, but there isn't a specific maximum limit mentioned for future expiration dates. According to the documentation, the TTL can't be more than five years in the past to be considered for expiry and deletion.

The TTL value must be stored in Unix epoch time format (in seconds). For example, if you set the expiration date to a specific future time like August 21st, 2024, the item will be expired after that specified time.

For your accounting data that needs to be retained for 10 years, you can set the TTL attribute to a timestamp that is 10 years in the future from when the item is created. This approach is valid and commonly used - you would calculate the expiration time by adding the desired retention period (in this case, 10 years) to the creation timestamp.

Keep in mind that TTL deletions are asynchronous and can take up to 48 hours or more after the expiration time for the actual deletion to occur. The TTL process runs roughly every six hours, but there's no guarantee on exact timing of deletions.
Sources
Computing time to live (TTL) in DynamoDB - Amazon DynamoDB
Data modeling building blocks in DynamoDB - Amazon DynamoDB
Using time to live (TTL) in DynamoDB - Amazon DynamoDB

answered a year ago

EXPERT

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.