OpsCanary
awsmessagingPractitioner

Mastering Dead-Letter Queues in Amazon SQS

4 min read AWS DocsApr 28, 2026
Share
PractitionerHands-on experience recommended

Dead-letter queues exist to tackle the problem of unprocessable messages in your messaging system. When a message fails to be processed successfully after a defined number of attempts, it can be moved to a DLQ. This prevents your main queue from being clogged with problematic messages, allowing your application to continue functioning smoothly.

In Amazon SQS, you configure a DLQ using the maxReceiveCount parameter, which determines how many times a consumer can receive a message from the source queue before it is redirected to the DLQ. For standard queues, if a message is received three or more times without being deleted, SQS moves it to the back of the queue. The ApproximateAgeOfOldestMessage metric helps you monitor the age of messages that haven't yet exceeded this threshold, giving you insight into potential processing issues.

In production, remember that using a DLQ with a FIFO queue can disrupt the exact order of message processing, which may not be acceptable for all applications. Always create a new queue before configuring it as a DLQ to ensure proper setup. Understanding these nuances will help you maintain a reliable messaging architecture.

Key takeaways

  • Set maxReceiveCount to control retries before messages are sent to a DLQ.
  • Use ApproximateAgeOfOldestMessage to monitor message processing delays.
  • Avoid using DLQs with FIFO queues to maintain message order.
  • Create a new queue before configuring it as a dead-letter queue.

Why it matters

In production, effectively managing message failures with DLQs can prevent bottlenecks and ensure your application remains responsive. This leads to improved user experience and system reliability.

Code examples

plaintext
maxReceiveCount

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.