0

I am using DynamoDB TTL attributes to delete data after certain time. I am able to save the deleted data by triggering the Lambda function of DynamoDB Streams (processed data).

Is it possible to trigger the Lambda function before the TTL attributes is deleted?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • @John Rotenstein thanks a lot – Kshitiz Jaiswal Jun 06 '19 at 09:43
  • Hey, did the answer end up working for you? If it did, you should accept it so that other SO users know that it solves the problem. If you had to tweak a few things or if you used a different solution, leave a comment or add your own answer to share that knowledge with others. – Matthew Pope Jul 20 '19 at 05:21

1 Answers1

0

DynamoDB streams will have a record for every change to an item (create, update, delete), so instead of saving to S3 when the item is being deleted, you could save it when the item is created. (And update the object in S3 when the Dynamo DB item is updated.)

Matthew Pope
  • 7,212
  • 1
  • 28
  • 49
  • Well yes seems to be a great idea , so the time I update my record with ttl Attributes at the same time i can save those data in S3 buckets. Thanks a lot @Matthew Pope – Kshitiz Jaiswal Jun 13 '19 at 04:16
  • I actually went with lambda triggers, since with your approach I had to take care of all the event ("INSERT","UPDATE" and "DELETE"). With Lambda triggers I am handling only "REMOVE" event and also monitoring any Lambda failure by using DLQ . I had to use DLQ , because for any failure in handling the dynamodb stream, Lambda keeps on trying to retry the failed event. – Kshitiz Jaiswal Jul 23 '19 at 01:45