aws-lambdaamazon-dynamodbamazon-sqsamazon-dynamodb-streams

DLQ redrive failed events back to DynamoDB streams?


I have a DynamoDB stream triggering a Lambda, and I want to push any failed events to a DLQ.

If the source of a DLQ is an SQS queue, it looks like you can do something called a redrive back to the source queue, where messages in DLQ will be moved back to the source queue.

I am guessing that this isn't possible with if the source is a DynamoDB stream?


Solution

  • AWS doesn't provide any mechanism as of now to replay failed dynamo DB streams from a DLQ. The messages in the DLQ will have the metadata of the event rather than the actual failed records. In case there is a need to replay the failed dynamo DB streams, it can be done in two step approach.

    1. Get the shard iterator from the event metadata
    2. Using the shard iterator, get the actual failed records from the Dynamo DB and process accordingly

    https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_GetShardIterator.html

    You may also refer to this link to get a working example.

    https://medium.com/aws-knowledge-tips-and-techniques/process-dynamodb-streams-using-aws-lambda-bc2c84562ce2