I've just created a plugin: serverless-plugin-lambda-dead-letter that can create a new dead letter queue (or topic) and attach it to a Lambda's
Unfortunately this is not supported in CloudFormation at this time so I've created the plugin to fill in the gaps.
The plugin can set the Lambda function's
DeadLetterConfig.TargetArn with one of the following:
- A newly created queue/topic created with simple syntax in the plugin's
- A pre-existing queue/topic using an
- A queue/topic created in manually in the
Resources section of the
This is helpful if you want to have more fault tolerant event handling.
In one case I've used it more as a retry mechanism:
- Configure lambda with a
deadLetter setup so failed events are forwarded to sqs.
- Set a scheduled event on the lambda with logic to retry events on the queue.
- Lambda has an internal unwrapping mechanism to handle events that were:
- Sent directly
- Sent via SNS
- Pulled from retry queue during a scheduled event.