Search code examples
aws-lambdastreamingamazon-dynamodbamazon-dynamodb-streams

AWS Lambda processing stream from DynamoDB


I'm trying to create a lambda function that is consuming a stream from dynamoDB table. However I was wondering which is the best practice to handle data that may not have been processed for some errors during the execution? For example my lambda failed and I lost part of the stream, which is the best way to reprocess the lost data?


Solution

  • DynamoDB Streams invokes the Lambda function for each event untill it successfully processes it (Untill the code calls success callback).

    In an error situation while executing, you need to handle it in code unless otherwise the Lambda won't continue with the remaining messages in the stream.

    If there is a situation where you need to process the message separate due to an error, you can use the dead letter queue (with Amazon SQS) to push the message and continue with the remaining items in the stream. You can have a separate logic to process the messages in this queue.