Amazon Simple Notification Service (SNS) is a simple distributed publish-subscribe system. It’s a cloud-based web service that uses the pub/sub messaging pattern to send individual or bulk messages to multiple recipients. It allows you to send push notifications to mobile device users, email recipients, or even send messages to other distributed services at the same time.
In SNS, there exist two types of clients: publishers and subscribers (otherwise referred to, respectively, as producers and consumers). Publishers create and send asynchronous messages to subscribers via a logical access point and communication channel (SNS topic). On the receiving side, subscribers (which include web servers, email addresses, Amazon SQS queues, or AWS Lambda functions) receive the published message or notification from the SNS service over supported protocols like Amazon SQS, HTTP/S, email, SMS, and Lambda.
How does SNS work?
Amazon SNS allows developers to coordinate, manage, and send notifications from the cloud via a suite of different avenues to subscribing endpoints/clients. To fanout messages using Amazon SNS, a component called a publisher simply pushes a message to the topic. The topics transfer messages and push them out immediately to all components that subscribe to the topic. Amazon SNS allows applications to transfer messages with very little or no queuing, unlike Amazon SQS that requires periodic ‘’checking’’ or ‘’polling’’ before messages are pushed to receivers.
Amazon SNS is composed of the following components/entities:
SNS Topics: logical access points that act as communication channels for pub/sub messaging. Each topic features a unique URI that identifies a specific subject, content, or event type. A topic allows developers to group multiple SNS endpoints (such as Amazon SQS, HTTP, HTTPS, AWS Lambda, email address, etc.) and filter out messages intended to be sent to different subscribers. To broadcast a message through Amazon SNS, publishers need to first create a topic for the message.
SNS Owners/Administrators: Create topics and own all access to the SNS topic. The owners define the permissions for all the AWS accounts that they create and own.
Publishers: clients that create and send asynchronous messages to an SNS topic. They communicate asynchronously with subscribers by producing and sending messages via a logical access point.
Subscribers: clients that want to consume or receive published messages or notifications on specific topics of interest.
How did AWS SNS come about?
Amazon Web Service Simple Notification Service (SNS) was initially released in April 2010 by Amazon. The motivation of this simple messaging system was to let app owners use a single API to send app push notifications to multiple platforms like iOS, Apple, Windows, Fire OS, and even to users in China through the Baidu Cloud Push (regardless of the app store that they use). Today, Amazon SNS is used by WunderList, Yelp, Hike Messenger, Yik Yak, among others.
Technical Overview of AWS SNS
Amazon SNS has a number of features aimed at developers. There are three basic APIs: CreateTopic, Subscribe, and Publish. Additional APIs exist for experienced developers. Both the basic and additional APIs allow publishers to deliver unique messages to multiple mobile devices once or several times.
There's a mobile push notification feature that allows developers to send notifications to applications different devices such as Apple, Google, and Kindle Fire Devices, and even to multiple endpoints including Email, SMS, HTTP/S endpoint, and Amazon SQS.
Amazon SNS uses a 256-bit AES-GCM algorithm and a customer master key (CMK) issued AWS Key Management Service (KMS) to store messages on the server. The messages are decrypted upon delivery to subscribing endpoints or to clients over supported protocols like AWS SQS queues, AWS Lambda functions, HTTP/HTTPS webhooks, etc.
There’s also VPC Endpoints (VPCE) that allows developers to publish private messages to SNS topics, using an Amazon Virtual Private Cloud (VPC).
AWS SNS Pros:
Fully-managed pub/sub messaging service
Push-based message delivery model (no polling)
Simple messaging architecture
Supports multiple avenues for notifications such as email, HTTP, and Lambda
Integration with other AWS solutions
Web-based AWS Management Console
Robust security features
AWS SNS Cons:
Insufficient debugging options
Difficult to format email
Read More…
AWS – Difference between SQS and SNS
Recommended Articles
Amazon Kinesis Data Streams
Kinesis Data Streams is a scalable and durable realtime data streaming service.
Microsoft Azure Service Bus
Learn about Microsoft Azure Service Bus, a messaging solution sending data between decoupled systems, including apps hosted in public and private clouds.
Lightstreamer
Learn about Lightstreamer, a realtime engine for asynchronous realtime data delivery over HTTP and WebSockets.