Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

AWS Serverless Failure Management With Dead-Letter Queues


Failure Management With Dead-Letter Queues

You can build specialized dead-letter queue resources using Amazon SNS or SQS.

A dead-letter queue is a place for messages that can't be delivered successfully.

It is recommended to enable special dead-letter queues for asynchronous Lambda functions.

For each function, you must first construct the queue or SNS topic.

It is because the Lambda function is configured as an event source.


Failure Management With Dead-Letter Queues Video

W3schools.com collaborates with Amazon Web Services to deliver digital training content to our students.


Queue policy

For the dead-letter queue on the source queue, you can create a queue policy.

The policy specifies how many times a message is retried before being rejected.

This allows you to see the queue independent of its goal.

Messages that fail after two built-in retries are directed to the dead-letter queue.

Dead-letter queue messages can help you analyze the cause of failure.


AWS Event Fork Pipelines

AWS Event Fork Pipelines are pre-built apps accessible in the AWS Serverless Application Repository.

They can help you reroute the communications back to their origin in case of failure.


Dead-Letter Queue on Lambda Function vs. Dead-Letter Queue on SQS Source Queue

The table below compares Dead-Letter Queue on Lambda Function and Dead-Letter Queue on SQS Source Queue.

Dead-Letter Queue on SQS Source Queue Dead-Letter Queue on Lambda Function
Dead-letter queue is part of queue policy Messages that fail after two attempts are forwarded to the dead-letter queue
Policy defines the number of retries before moving an item to dead-letter queue Configuration of a dead-letter queue as part of a function
Need a way to send messages back to the source for processing

Related reads:

AWS Lambda Function Dead-Letter Queues
Amazon SNS Dead-Letter Queues
Amazon SQS Dead-Letter Queues

AWS Serverless Exercises

Test Yourself With Exercises

Exercise:

Where will a message go if it can't be successfully delivered?

To a  

Start the Exercise