8.3 SNS - Simple Notification Service
What is SNS
Amazon SNS is web service that makes it easy to set up, operate, and send notifications from the cloud. It provide developers with a high scalable, flexible, and cost-effective capability to publish messages from an application and immediately deliver them to subscribers or other applications. Actually, SNS is a mobile service, not an application service.
Every time you have an auto-scaling event, that is going to trigger an SNS message and it is either going to email or it is going to send you a text.
Push notifications to Apple, Google, FireOS, and Windows devices, as well as Android devices in China with Baidu Cloud Push.
Besides pushing cloud notifications directly to mobile devices, SNS can also deliver notifications by SMS (Short Message Service) text message or email, to SQS, or to any HTTP endpoint. SNS notifications can also trigger Lambda functions. When a message is published to an SNS topic that has a Lambda function subscribed to it, the Lambda function is invoked with the payload of the published message. The Lambda function receives the message payload as an input parameter and can manipulate the information in the message, publish the message to other SNS topics, or send the message to other AWS services.
In the exam, SNS is normally around Auto-Scaling, CloudWatch or finding some way to notify you when something happens (e.g. Alarms), and the exam will also compare SNS to SQS.
SNS allows you to group multiple recipients using topics. A topic is an "access point" for allowing recipients to dynamically subscribe for identical copies of the same notification. One topic can support deliveries to multiple endpoint types - for example, you can group together iOS, Android and SMS recipients. When you publish once to a topic, SNS delivers appropriately formatted copies of your message to each subscriber.
To prevent messages from being lost, all messages published to Amazon SNS are stored redundantly across multiple availability zones.
SNS Subscribers/Protocols
HTTP
HTTPS
Email
Email - JSON
SQS
Application
Lambda
SMS (Short Message Service)
Steps:
Go to Mobile Services and go to SNS.
Create Topic.
Create a Subscription. The topic ARN will be provided to you, and you need to select the Protocol (Email, HTTPS, HTTP or Lambda) and give it an endpoint.
You can see the subscriptions are listed.
Click Publish to this Topic. TTL can be 300 seconds. (The TTL of this message in queue).
SNS Benefits
Instantaneous, push-based delivery (no polling). SQS is pull-based.
Simple APIs and easy integration with applications.
Flexible message delivery over multiple transport protocols.
Inexpensive, pay-as-you-go model with no up-front costs.
Web-based AWS management console offers the simplicity of a point-and-click interface.
SNS vs. SQS
Both messaging services in AWS
SNS - push-based. Mobile service.
SQS - pull-based (poll). Application service.
SNS Pricing
Users pay $ 0.5 per 1 million Amazon SNS requests.
$ 0.06 per 100,000 Notification deliveries over HTTP.
$ 0.75 per 100 Notification deliveries over SMS.
$ 2.00 per 100,000 Notification deliveries over Email.
Last updated
Was this helpful?