October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

The DynamoDB TTL Trap: Why “Deleted” Data Still Appears and How to Fix It

DynamoDB TTL marks an item eligible for background deletion, but it can remain visible. Diagnose configuration and formatting, and enforce expiration in reads and writes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

DynamoDB TTL does not delete an item at its timestamp. That timestamp makes the item eligible for asynchronous, best-effort deletion; until DynamoDB removes it, the item can still appear in reads, queries, and scans. If your application must stop serving expired records immediately, enforce expiration in your read and write logic rather than relying on TTL cleanup.

Why expired DynamoDB items are still showing up

TTL is background cleanup, not a read-time visibility rule. An item whose expiration time has passed may remain in the table while DynamoDB processes eligible deletions. AWS says deletion typically happens within a few days in its TTL guide; the UpdateTimeToLive API reference says typically within two days and notes that timing depends on workload. Neither is a deadline or guarantee. AWS describes deletion as best effort to preserve throughput for other data operations.

As an Amazon Associate I earn from qualifying purchases.

Until physical deletion, an expired item can still be returned by a GetItem, Query, or Scan unless your application excludes it. It also continues to count toward storage and read costs until deleted, as AWS notes in its expired-items guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnose TTL in this order

  1. Confirm TTL is enabled on the table you are actually querying. Enabling TTL can take approximately one hour to process across all partitions. Check the table’s TTL configuration in the AWS console or with your normal table-configuration tooling. See AWS’s TTL enablement guide.
  2. Match the attribute name exactly. The configured TTL attribute name is case sensitive. If the table is configured for expiresAt but an item stores ExpiresAt, TTL will not use that differently cased field.
  3. Inspect the stored type and unit. The TTL field must be a DynamoDB Number containing a Unix epoch timestamp in seconds. A String or a millisecond timestamp is not the specified format. Also, items with a TTL timestamp more than five years in the past are not eligible for deletion. Details are in AWS’s TTL computation guidance.
  4. Check whether the read path filters expiration. Even a correctly configured, expired item can remain visible while deletion is pending. For Query and Scan results, compare the TTL value with current epoch seconds and keep only items whose expiration is still in the future. AWS demonstrates this approach in its expired-items guide.
  5. Review writes to expired-but-present items. If an expired record must not be updated or recreated through a write path, use a condition expression that encodes your application’s expiration rule. TTL deletion alone does not prevent a write from touching an item that has not yet been physically removed.

Hide expired items now; let TTL clean them up later

These are separate responsibilities. A read-time expiration check controls what your application returns as soon as the timestamp passes. A conditional write controls whether an expired-but-still-present item can be modified. TTL eventually removes eligible data from the table, but does not promise exact-time deletion.

#1 Best Overall

For Query or Scan, use a filter expression that compares the numeric TTL attribute to current epoch seconds, retaining records with a value greater than now. If the application uses other read patterns, apply the equivalent check before returning an item. Keep the filter aligned with the same expiration rule used by write conditions; otherwise an item can be hidden on reads yet still be changed by a separate write path.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What to expect from Streams and Global Tables

If DynamoDB Streams is enabled, a TTL removal appears as a service deletion. In the Region where deletion occurs, AWS documents the stream record identity as userIdentity.type = Service and userIdentity.principalId = dynamodb.amazonaws.com. For a replicated deletion in another Global Tables Region, that identity marker is not set. Consumers that archive or react to TTL deletions should account for the regional difference, described in the Streams and TTL guide.

For Global Tables version 2019.11.21, AWS documents TTL deletions as replicating to all replica tables. The initial delete does not consume write capacity in the Region where expiry is processed; replicated deletes consume replicated write capacity or replicated write units in replica Regions, and applicable charges can apply. Check the current billing mode and AWS pricing for a cost estimate; the behavior is explained in the TTL guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.