Image from @awsgeek
Simple Notification Service
- 📒 Homepage ∙ Documentation ∙ FAQ ∙ Pricing
- SNS (Simple Notification Service) is a pub/sub based, highly scalable, and fully managed messaging service that can also be used for mobile notifications.
- SNS can push the messages down to the subscribers via SMS, Email, SQS, and HTTP/S transport protocols.
- Producers publish messages to a SNS Topics, which can have many subscribers.
- Each subscription has an associated protocol, which is used to notify the subscriber.
- A copy of the message is sent to each subscriber using the associated protocol.
- SNS can also invoke lambda functions.
SNS Alternatives and Lock-In
- Popular alternatives to SNS are Kafka, Notification Hubs on Azure, and Pub/Sub on Google Cloud.
- SNS vs SQS:
- Both SNS and SQS are highly scalable, fully managed messaging services provided by AWS.
- SQS supports a pull model, while SNS supports a push model. Consumers have to pull messages from an SQS Queue, while they're pushed the message from an SNS Topic.
- An SQS message is intended to be processed by only one subscriber, while SNS topics can have many subscribers.
- After processing, the SQS message is deleted from the queue by the subscriber to avoid being re-processed.
- An SNS message is pushed to all subscribers of the topic at the same time, and is not available for deletion at the topic.
- SNS supports multiple transport protocols of delivery of the messages to the subscribers, while SQS subscribers have to pull the messages off the queue over HTTPS.
- Fan-out architecture can be achieved by having multiple subscribers for a topic. This is particularly useful when events have to be fanned out to multiple, isolated systems.
- SNS topics can be used to power webhooks with backoff support to subscribers over HTTP/S.
- SQS queues can subscribe to SNS topics.
- SNS is used to manage notifications for other AWS services like Autoscaling Groups' notifications, CloudWatch Alarms, etc.
- SNS is frequently used as “glue” between disparate systems— such as GitHub and AWS services.