The SNS Fan-Out Pattern

~8 min read

Combining SNS's broadcast capability with SQS's durability for reliable multi-consumer event distribution.

In the fan-out pattern, a publisher sends one message to an SNS topic, which has multiple SQS queues as subscribers rather than direct Lambda or HTTP endpoint subscriptions. SNS delivers a copy of the message to each subscribed queue, and each queue's consumer then processes it independently, with all of SQS's normal guarantees — durability, visibility timeout, retry via redelivery, and Dead Letter Queue support — applying separately to each downstream consumer.

This is more resilient than subscribing consumers directly to the SNS topic: if a direct HTTP or Lambda subscriber is briefly unavailable when SNS delivers a message, that delivery can be lost (SNS retries delivery for a limited time/attempts, but doesn't durably queue it the way SQS does); with fan-out to SQS in between, the message sits safely in that consumer's own queue until it's actually processed, regardless of how long the consumer was unavailable.

This pattern is also what allows independently adding new consumers over time without touching the original publisher — a new team can simply create a new SQS queue, subscribe it to the existing topic, and start receiving a copy of every future event, with zero changes needed to the system that originally publishes those events.

💬 Deep Dive with AI

Key points

  • Fan-out = SNS topic with multiple SQS queues as subscribers, not direct Lambda/HTTP subscriptions
  • Each queue gets SQS's own durability/retry/DLQ guarantees independently
  • More resilient than direct subscriptions, which can lose messages if the subscriber is briefly down
  • New consumers can be added later with zero changes to the original publisher