AWS SNS Topics and Subscriptions
You'll learn: How to use AWS SNS to publish messages once and deliver them to multiple subscribers simultaneously.
What is SNS?
Amazon Simple Notification Service (SNS) implements the pub/sub pattern (publish-subscribe). Think of it like a radio station: one broadcaster (publisher) sends a message, and many listeners (subscribers) receive it at the same time. Unlike SQS queues where one consumer gets each message, SNS delivers copies of each message to all subscribers.
How Topics and Subscriptions Work
An SNS topic is a communication channel. Publishers send messages to the topic, not directly to subscribers. Subscriptions define who receives messages from that topic.
When you publish a message to an SNS topic, AWS SNS automatically pushes copies to all subscribed endpoints:
- SQS queues (fan-out pattern to multiple queues)
- HTTP/HTTPS endpoints (webhooks)
- AWS Lambda functions (trigger serverless processing)
- Email addresses
- SMS messages
- Mobile push notifications
Common Use Cases
Fan-out architecture: Publish one message to SNS, which then delivers it to multiple SQS queues for parallel processing by different systems.
Decoupling microservices: Services subscribe to topics they care about without knowing who publishes to them.
Multi-protocol notifications: Send the same alert via email, SMS, and trigger a Lambda function simultaneously.
Message Filtering
Subscribers can use filter policies to receive only messages matching specific criteria, reducing unnecessary processing.
Key Takeaway: AWS SNS topics enable one-to-many message distribution, publishing a single message that gets automatically delivered to multiple subscribers (queues, Lambda functions, HTTP endpoints) simultaneously—perfect for broadcasting events and fan-out architectures.