Why is AWS SNS (or Simple Notification Service) so popular among business users? AWS SNS, you can send SMS or text messages to recipients in over 200 countries. Plus, there is no minimum or upfront fee - and like any cloud-based service, you only pay for what you use.
|Want to become a Certified AWS Professional? Visit here to Learn AWS Certification Training|
In this AWS SNS blog, you will learn the below topics:
In simple terms, AWS Simple Notification Service (or AWS SNS) is a cloud-based web service that delivers messages. In other words, the AWS SNS service coordinates and manages the delivery of push messages to clients or subscribed endpoints. AWS SNS, you can also create and deliver a messaging service for distributed networks and serverless applications.
Easy to configure on the cloud, AWS SNS is a scalable and cost-effective service that can create and publish from cloud-based applications to other applications. In the following sections, let’s discuss how Amazon SNS works and how to configure its complete setup.
AWS SNS is a push-based messaging service that sends messages from publishers to many subscriber endpoints.
How does push-based messaging work? In this form, a publisher sends out a message to the subscriber immediately instead of storing the message.
Who is a publisher? A publisher is an entity that sends the messages to the message topics that they have created or have permission to publish.
Who is a subscriber? A subscriber is an entity that receives the messages to the topics that they have subscribed to.
Additionally, SNS services can also send messages to different devices by delivering push notifications to Apple, Google, and Windows-based devices.
|Learn more about AWS|
As mentioned earlier, AWS SNS uses the Publisher-Subscriber model to send messages to its endpoints. Using Amazon SNS, you can filter the messages to a larger number of subscribers or end points through mobile messages, SMS, and email.
Shown below is an illustration of the various steps executed by AWS SNS.
Here are the exact workflow steps that are Implemented by AWS SNS:
1) First, the publisher sends out the required notifications that are to be delivered to subscribers.
2) The published messages are delivered to the SNS service, which has the following key components:
3) The subscriber receives the message through subscribing queues or microservices. Subscribers provide useful information such as URL address, email address, or phone number in order to receive the message.
Here are some of the common types of SNS messages that are sent:
Application & System alerts, that are automatic user notifications triggered by predefined thresholds and sent to specific users through SMS or email.
Push email or text messaging, which are two ways of sending messages to individuals or groups (example, news article notifications sent to the newspaper subscribers).
Mobile push notifications, that are direct messages sent to mobile apps (for example, notifications about any app update that is available for installing).
Amazon SNS offers 4 key benefits including:
The Amazon SNS service stores its messages in cross availability zones across AWS regions. As a result, each message is now available across multiple regions at the same time – thus providing high reliability. Additionally, Amazon Web Service (AWS) has a global network of data centers that allows publishers to send messages at any time.
Amazon SNS also supports messaging on all AWS endpoints including Amazon SQS and AWS Lambda. In case the subscriber endpoint is not supported, the SNS service retries message delivery and can move its messages to dead-letter queries (or DLQ).
With the Amazon SNS service, you can dynamically scale the number of your message requests from any application. Amazon SNS uses the scaling capability of the AWS cloud platform to achieve this benefit.
Apart from automatic scalability, Amazon SNS is designed for high throughput and changes in traffic patterns. With Amazon SNS, you can plan your workload using capacity planning and provisioning. Plus, there is no upfront cost nor the need to install any messaging software.
Using the Amazon SNS service, you can simplify your overall messaging architecture by removing your message filtering mechanism (from the subscriber) and message routing (from the publisher). The SNS service takes care of your message filtering that allows subscribers to only receive messages of their interest – instead of all the published messages in the SNS topic.
As an SNS topic owner, you can set topic-related policies that specify the type of network protocols. You can also specify the users who can publish or subscribe to a particular topic. Other security measures include the limit on the number of daily messages along with keeping messages for “one-time password” (or OTP) transactions private and secure.
Amazon SNS also supports message encryption to keep your data secure. With the use of the Amazon PrivateLink service, you can publish private messages to SNS topics from any Amazon VPC subnet.
|Frequently Asked Amazon Web Services Interview Questions|
Let’s now understand how Amazon SNS uses message filtering to deliver a subset of SNS topic messages to the subscribed endpoints. For simplicity, let’s take a business website that routes user requests to different backend servers.
This server network comprises of:
Here are the 6 steps to implement message filtering with the Amazon SNS service:
The first step is to create the Amazon SNS topic that will publish messages – whenever any user request is made on the website.
The next step is to create the Amazon SQS queues that will be subscribed to the SNS topic. The website backend servers poll the user requests from its corresponding SQS message queue. For this example:
|Related article: AWS Projects|
This step is necessary to subscribe to the newly created SQS queues to the Amazon SNS topic that will send out relevant SNS messages. For our example, we shall subscribe our three queues (Queue_1, Queue_2, and Queue_3) to “Topic_1” topic.
After creating your SNS topic and SQS queues, you now need to set filter policies for your SNS subscriptions. Created as a JSON doc, a filter policy defines the type of message notifications that would interest the subscriber. Subscriptions without any filter policies would receive all messages that are published to the SNS topic (in our example, Queue_3 as it handles all requests).
The next step is to test the message filtering mechanism to see if it publishes the right messages to the subscribers.
a. From the “Topic_1” details page in the Amazon SNS console, click “Publish a message.”
b. Enter the following message details in the “Publish message to topic” page. Here is a sample screen:
c. Publish your first message.
d. Repeat the above steps to add two more messages (Message#2 and Message#3) with the same parameters as above. For both messages, specify the Value attribute as “type 2.”
The next step is to verify if the new messages are routed to the correct SQS queue with the message filter policy.
You will observe that Queue_1 will receive only Message#1 – while Queue_2 will receive both Message#2 and Message#3. At the same time, Queue_3 will receive all three messages as it does not have any configured filter policy.
|Explore AWS Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download Now!|
With the use of the Amazon Simple Notification Service (or SNS), you can deliver the right messages to subscribers or endpoints. Through the use of the publisher-subscriber model, Amazon SNS is a highly available and scalable service for sending push messages to distributed systems, microservices, and serverless applications.
Do you want to know more about the capabilities of the AWS SNS service and how it can work for you? Leave behind your comments in the section provided below.
|AWS Certified SysOps Administrator||AWS Certified Solutions Architect / Professional|
|AWS Certified Developer||AWS Certified DevOps Engineer|
|AWS Technical Essentials||AWS Database Migration Service|
|AWS Lambda 2016||and many more...|
If you interested to learn AWS and building a career in Cloud Computing? Then check out our AWS Certification Training Course at your near Cities
AWS Certification Course in Ahmedabad, AWS Certification Course in Bangalore AWS Certification Course in Chennai, AWS Certification Course in Delhi, AWS Certification Course in Dallas, AWS Certification Course in Hyderabad, AWS Certification Course in London, AWS Certification Course in Mumbai, AWS Certification Course in NewYork, AWS Certification Course in Pune
These courses are incorporated with Live instructor-led training, Industry Use cases, and hands-on live projects. This training program will make you an expert in AWS and help you to achieve your dream job.
Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!
|AWS Training||Jun 03 to Jun 18|
|AWS Training||Jun 06 to Jun 21|
|AWS Training||Jun 10 to Jun 25|
|AWS Training||Jun 13 to Jun 28|
Prasanthi is an expert writer in MongoDB, and has written for various reputable online and print publications. At present, she is working for MindMajix, and writes content not only on MongoDB, but also on Sharepoint, Uipath, and AWS.
Copyright © 2013 - 2023 MindMajix Technologies