AWSDOP-C02
On this page
Beginner-friendly overview

SNS

SNS is a pub/sub messaging service. A producer publishes a message to a topic, and SNS immediately delivers that message to every subscriber of that topic simultaneously — whether there's one subscriber or ten thousand.

Push vs Pull

The key distinction between SNS and SQS is direction: SQS is pull-based (consumers fetch messages when they're ready), while SNS is push-based (SNS delivers messages to subscribers immediately). In SQS, one consumer gets each message. In SNS, every subscriber gets every message.

This makes SNS the right tool for fan-out — broadcasting a single event to multiple independent systems at once. An order placed event published to SNS can simultaneously trigger a fulfillment service, a notification service, an analytics pipeline, and a fraud-detection system, all without those systems knowing about each other.

One publish → SNS pushes a copy to every subscriber, immediately Publisher "order placed" SNS Topic the megaphone publish ×1 SQS queue → consumer Lambda function HTTP/HTTPS endpoint Email / SMS Mobile push (APNs/FCM) every subscriber gets a copy Mixed subscriber types on the same topic — filter policies decide who receives which messages
SNS shouts, SQS queues, EventBridge sorts. SNS is a megaphone: one shout, and every subscriber instantly hears its own copy (push). SQS is a mailbox: one letter waits until a single reader collects it (pull). The classic fan-out pattern is simply a megaphone aimed at a row of mailboxes — SNS broadcasts, each SQS queue catches a durable copy for its own consumer.

What Can Subscribe

SNS subscribers can be Lambda functions, SQS queues, HTTP/HTTPS endpoints, email addresses, SMS phone numbers, and mobile push endpoints (APNs, FCM). A single topic can have subscribers of different types at the same time.

The SNS + SQS Fan-Out Pattern

SNS and SQS are frequently used together. You publish to an SNS topic, and multiple SQS queues subscribe to it. Each queue then drives its own independent consumer. This pattern gives you:

  • Fan-out: one message reaches many consumers
  • Durability: SQS holds messages if a consumer is temporarily down
  • Decoupling: each consumer processes at its own pace

For example, an "image uploaded" event hits an SNS topic. A thumbnail-generation SQS queue, a virus-scanning SQS queue, and a metadata-extraction SQS queue all receive a copy. Each is processed independently and at its own speed.

Message Filtering

Subscribers can attach a filter policy to a topic so they only receive messages that match certain attributes. This lets you use a single topic for many event types and have each subscriber receive only the ones relevant to it — without needing a separate topic per event type.