Amazon Simple Notification Service (Amazon SNS) is a web service that coordinates and manages the delivery of sending messages to subscribing endpoints or clients. In Amazon SNS, there are two types of clients—publishers and subscribers—also referred to as producers and consumers. Publishers produce and send messages to a ‘topic’ asynchronously and subscribers subscribe to those topics in order to consume those messages. For the AWS Certified Solutions Architect Associate, Certified Developer and SysOps Administrator exams, you need to understand the core concepts of Amazon SNS, it features and configuration options and under what scenarios you would recommend using it.
Important Note – Amazon SNS works on a push based method of messaging, whereas, Amazon SQS works on the basis of polling to retrieve new messages.
Subscribers can be web servers, email address, SQS queues or Lambda functions and they can receive messages using the following supported protocols:
- Amazon SQS. Note that users should create the SQS queue prior to subscribing it to a Topic.
Topics are the medium through which Publishers send messages to Subscribers. Key Points to note:
- You control access to a topic by defining policies that determine which publishers and subscribers can communicate with the topic.
- A publisher sends messages to topics that they have created or to topics they have permission to publish to.
- Amazon SNS matches the topic to a list of subscribers who have subscribed to that topic, and delivers the message to each of those subscribers.
- Topics has a unique name that identifies the Amazon SNS endpoint for publishers to post messages and subscribers to register for notifications.
- Subscribers receive all messages published to the topics to which they subscribe, and all subscribers to a topic receive the same messages
Common Amazon SNS Scenarios
The “fanout” scenario is when an Amazon SNS message is sent to a topic and then replicated and pushed to multiple subscriber across different protocols for different components of your application. So these protocols will be either Amazon SQS queues, HTTP endpoints, or email addresses.
Thus, you get parallel asynchronous processing. For example, in an eCommerce application, you can send an Amazon SNS message to a topic whenever an order is placed for a product. An email subscriber could send out email alerts to the customer and at the same time an Amazon SQS queues that has subscribed to that topic would receive identical notifications for the new order and update the inventory database or the accounting application. You could also have an Amazon EC2 server instance attached to a data warehouse for analysis of all orders received.
Application and Systems Alerts
Alert notification messages can be pushed out to subscribers who need to receive immediate notifications of any events that occur with their application or systems based on certain predefined thresholds. An example includes being notified when your Windows EC2 instances are running out disk space.
Push Email and Text Messaging
You can use Amazon SNS to transmit messages in the form or push email or text to individuals and groups via email and SMS respectively. Amazon SNS can be configured to push a variety of information to subscribers such as news headlines, weather reports or excerpts of information where the subscriber can then learn more by clicking on a link in the notification message.
Mobile Push Notifications
Amazon SNS is often used to send out mobile push notification messages directly to mobile apps. Often used to notify you of updates to mobile apps, the notification messages will then prompt you to download the updates and install for your mobile applications.
Amazon SNS vs. Amazon SQS
Unlike other Amazon services such as SQS which utilise a polling technology where periodic checks or ‘polls’ are made for updates, Amazon SNS allows applications to send time-critical messages to subscribers using a ‘push’ mechanism. Amazon SNS is more suited to certain scenarios where SQS may not necessarily be the best service to use. As part of the exam, it’s important you understand which service to use under what scenario and business requirement.
Additional Exam Tips
Amazon SNS follows the “publish-subscribe” concept, and notifications being delivered to clients using a “push” mechanism that eliminates the need to periodically check or “poll” for new information and updates. Uses of using Amazon SNS include:
- Instantaneous push-based delivery (no polling)
- API integration with applications
- Messages can be delivered over a number of transport protocols
- Management console to offer simple point and click interface
- Messages cannot be deleted once published to a topic. There is no recall facility
- Amazon SNS will attempt to deliver messages in the order it was published, but this is not 100% guaranteed
740 Practice Exam Questions – Get Prepared for your Exam Day!
Our Exam Simulator with 740 practice exam questions comes with comprehensive explanations that will help you prepare for one of the most sought-after IT Certifications of the year. Register Today and start preparing for your AWS Certified Solutions Architect – Associate Exam