On this page
On this page
- What Is SNS
- Core Concepts
- SNS + SQS Fan-Out Pattern
- Message Filtering
- SNS FIFO Topics
- Dead Letter Queues
- Cross-Account SNS
- Message Size and the Extended Client Library
- Delivery Guarantees
- SNS vs EventBridge
- Key Exam Scenarios
- CloudWatch Integration
- Automatically Published (AWS/SNS namespace — per publish/delivery)
- Requires Setup
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.
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.