DynamoDB TTL Converter
Decode a DynamoDB TTL value to a readable date, or turn a date into the epoch seconds to store — with a warning when a value looks like milliseconds.
Times shown in UTC. TTL deletions happen within ~48 hours of expiry.
How DynamoDB TTL works
Time to Live (TTL) lets DynamoDB expire items automatically at no extra cost. You designate one Number attribute as the TTL attribute; its value is a Unix epoch timestamp in seconds. A background process compares each item’s TTL against the current time and deletes items whose time has passed — typically within 48 hours, on a best-effort basis.
Because the value is seconds, a millisecond timestamp is the number-one TTL bug: a value from JavaScript’s Date.now() is 1000× too large, so the item’s expiry lands in the distant future and it is never removed. This converter auto-detects the unit and flags that case so you catch it before it ships.
Expiring items automatically is one part of sizing a table — the DynamoDB TTL guide covers enabling it, backfilling values, and filtering expired items from reads.
Frequently asked questions
What format does a DynamoDB TTL attribute use?
A DynamoDB Time to Live (TTL) attribute must be a Number holding a Unix epoch timestamp expressed in seconds — the number of seconds since 1970-01-01 UTC. DynamoDB compares that value against the current time and deletes the item once it is in the past. It must be seconds, not milliseconds, and not an ISO date string.
Why isn’t my DynamoDB TTL deleting items?
The most common cause is storing milliseconds instead of seconds. A millisecond value like 1700000000000 read as seconds is a date tens of thousands of years in the future, so the item never expires. Divide by 1000. Also confirm TTL is enabled on the table and pointed at the correct attribute — items with no value in that attribute are never expired.
How long after the TTL time does DynamoDB delete an item?
DynamoDB typically deletes expired items within a few days of the expiration time — AWS documents a best-effort window of up to 48 hours, and longer under load. Expired items may still appear in reads, Scans, and Queries until the background process removes them, so filter on the TTL attribute if you need to hide them immediately.
Does the TTL time have to be in the future?
No. If you write a TTL value that is already in the past, the item becomes eligible for deletion immediately and is removed on the next background sweep. Setting the TTL to the current epoch seconds is a common way to schedule an item for near-term deletion.