AW

Amazon SQS & SNS

Event-driven messaging, pub/sub, and dead-letter queues

Details

Language / Topic
awsAmazon Web Services
Category
Architecture

Rules

balanced
- Use SNS for pub/sub fan-out architectures and SQS for reliable worker queues.
- Always attach a Dead Letter Queue (DLQ) to SQS queues to catch unprocessable messages.
- Combine SNS and SQS for the "fan-out" pattern: publish domain events to an SNS topic, and subscribe multiple independent SQS queues.
- Always configure a Dead Letter Queue (DLQ) with appropriate `maxReceiveCount` on every SQS queue to isolate poison pills.
- Process SQS messages in batches to increase throughput and reduce costs.
- Ensure all message processing logic is strictly idempotent to handle at-least-once delivery anomalies.