is it possible to invoke lambda only on items expiring from dynamo?

Sadly, you can’t make DynamoDB stream, to stream only deletion or expiration of items. Everything is streamed, and its up to your lambda function to filter the events of interests.

For TTL expired items, your function needs to check:


        "userIdentity":{
            "type":"Service",
            "principalId":"dynamodb.amazonaws.com"
        }

An alternative way, is to have second table, only with TTL markers. This could be useful, if your primary table experiences a lot of updates and modifications. This way, the stream on your second table would only invoke your function twice for each item, i.e. creation and TTL expiration, rather then for all the updates you are not interested in.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top