DynamoDB Time to Live (TTL) does not trigger a standard delete operation. When a record expires, DynamoDB removes it from your table silently in the background. If you rely on event-driven architectures to archive data to S3 or update downstream analytics tables, expecting a standard DeleteItem call will leave your audit logs and data lake incomplete.
The solution requires enabling DynamoDB Streams to capture the REMOVE event generated by the TTL process. This approach ensures that every record lifecycle event—whether initiated by an application or the internal TTL sweeper—is captured and delivered to your consuming architecture. This guide covers how to implement this pattern using Terraform and Lambda, focusing on the mechanics of stream processing.
How it actually works
The TTL sweeper process runs periodically to identify expired items. When an item is deleted, the event contains a userIdentity field of dynamodb.amazonaws.com .…