What is Amazon Simple Notification Service

Since 2010, Amazon Web Services has included a notification service called Amazon Simple Notification Service. It offers a cheap infrastructure for sending messages in bulk, mostly to mobile consumers. In this article, we will discuss more SNS, AWS SNS, the clients involved in SNS, and various types of AWS SNS. We will also put some light on the benefits of SNS and the working of SNS message filtering.

What is Amazon SNS?

It is defined as a service on the web that facilitates the management, setup, and cloud notification sending. It gives programmers the incredibly flexible, affordable, and scalable capacity to post messages from one app and transmit them to other apps. Publishers and subscribers, often called consumers and producers, are the two categories of users in Amazon SNS.

Amazon sns

By creating and then sending a message, serving as the main entry point and a communication channel, publishers engage in asynchronous communication with subscribers. The notification or a message is consumed or received by subscribers (email addresses, Lambda functions, web servers, Amazon SQS queues) via one of the standard protocols ( HTTP/S, Amazon SQS, email, SMS, AWS Lambda).

We have the perfect professional AWS Training course for you. Enroll now!

Amazon SNS Clients

The two main clients of Amazon SNS are given below:

  • Publishers: Publishers, also referred to as producers, create the message and deliver it to the SNS, serving as a practical entry point.
  • Subscribers: The message or notification from the SNS is received by subscribers such as web servers, email addresses, Amazon SQS queues, and AWS Lambda functions over the supported network protocols such as email, SMS, Amazon SQS, Lambda, and HTTP.

Amazon SNS

The message is sent by the publisher to an SNS topic they have made. Since the subject itself identifies the subscribers linked with the topic that the publisher has formed and then delivers that message to subscribers, it is not necessary to specify the address of the destination when publishing the message.

AWS Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

Working of AWS SNS

The paradigm between the publisher and the subscriber is used by AWS SNS to transmit messages from its destinations. A user is able to work with Amazon SNS for filtering the messages so that they are sent to more destinations or subscribers with the help of email, SMS, as well as mobile communications.

An explanation of the various actions taken by AWS SNS is provided below. 
The precise workflow stages used by AWS SNS are detailed below:

  • The publisher initially delivers the necessary notices that must be sent to subscribers.
  • The service of SNS, comprising the following essential elements, receives the published messages.

SNS Topic :

The messages that need distribution of various subscribers are filtered out using SNS Topics. As a developer of AWS, a user must first construct the SNS serving as the subscribers' accessing location. The subscribers are able to choose to receive the text notifications on a certain topic by making use of the topic.

Message Filter:

The SNS messages enter the message filter after being detached using topics, where they are then further filtered according to the subscriber's chosen policy. After reviewing the policies and obtaining permissions, the emails finally reach the appropriate subscribers.

  • Via microservices or subscriber queues, the message is sent to the subscriber. Subscribers must provide useful details such as an URL, email address,and phone number to receive the message.

Application and system alerts are automated user alerts that are delivered to particular users via email or SMS when certain criteria are reached.
Text messaging or push email are 2 main methods for enabling the communication with different people or various groups such as newspaper subscribers get notifications about news

Mobile apps receive direct messages via mobile push notifications such as pop up notifications for any application that is being installed.

  Want to know more about AWS ,visit here AWS Tutorial !

Benefits of AWS SNS

High Reliability

Messages are stored by the Amazon SNS in cross-region AWS availability zones. Every message has become simultaneously accessible across several locations, offering excellent reliability. Publishers can send messages anywhere at time due to the worldwide network of data centres that AWS possesses.

Message Filtering

By eliminating your message filtering system as well as message routing, you can streamline the overall architecture of messaging with the help of Amazon SNS. The SNS handles message filtering so that users only receive messages that are relevant to them rather than all of the published messages inside the subject of SNS.

Automatic Scalability

A person is able to dynamically scale the quantity of message requests coming from any application using the Amazon SNS service. To provide this benefit, Amazon SNS uses the AWS cloud platform's scaling capabilities.

In addition to having automated scaling, Amazon SNS is built for maximum bandwidth and shifting traffic patterns. Utilising capacity planning and provisioning, you may organise the workload with Amazon SNS. Additionally, there are no upfront costs or software installations required.

Security

A user can establish topic-related policies that outline the kind of network protocols as the owner of an SNS subject. Users can also publish as well as subscribe to a certain topic which is very specific. The daily message limit and the confidentiality and security of communications for "one-time password" (or OTP) transactions are further security features.

How does Amazon SNS message filtering work?

The servers in this network include:

  • One server for handling "type 1" user requests.
  • One server for handling "type 2" user requests.
  • One data analytics server that manages "type 1" as well as "type 2" user queries.

To setup message filtering on Amazon SNS service, follow these 6 steps

Subscribe to our youtube channel to get new updates..!

Creating an Amazon SNS Topic

For publishing the messages for a request of the user submitted on the site, the very initial step is to build the Amazon SNS subject.

  • Enter your userID as well as password for logging in to the AWS a fresh topic, click “Create topic” from the Console.
  • Utilise the "AWS Services" search icon for accessing the Amazon SNS service panel.
  • Click "Start with an overview" and then "Topics" from the left menu on the SNS console's home page.
  • Next, select "Create topic" and then enter the topic's name ("Topic 1") in the dialogue box's "Topic name" box
  • To create a new topic and add it to the "Topic" details page, click "Create topic" in the dialogue box above.

1.Create SQS Queues for Amazon

This step will be connected to the SNS subject and must first be created. The backend servers of the website poll the associated SQS message queue for user requests. In this instance:

  • Queue 1 handles "type 1" user requests.
  • Queue 2 manages "type 2" user requests.
  • "Type 1" as well as "type 2" user requests are handled by Queue 3.
  • Enter the username as well as the password to log in to the AWS SQS Console.
  • The next step is to put "Queue_1" in the "Queue_Name" field on "Create New Queue". Click "Quick-Create_Queue" with the "Standard Queue" choice made.
  • Create 2 more queues using "Queue_2" and "Queue_3" by redoing the step above. This creates the 3 SQS queues for the SQS page.

2.Subscribe The Topic Queues

Subscribing the freshly built queues in SQS for broadcasting the SNS messages, the following step will be performed.

We'll subscribe all the 3 queues to the topic "Topic 1" for an example.

  • Choose the 3 queues from the list of available queues on the AWS SQS dashboard, and press ‘Queue Actions’ followed by "Subscribe Queues to SNS Topic."
  • Select your specified SNS topic (Topic 1) that you established from the "Choose a Topic" list in "Subscribe to a Topic" box.
  • Make use of "Topic ARN" parameter to subscribe the queues to SQS queues established by external users.
  • Subscribe the specified queues to the chosen topic, click Subscribe.

3.Setting up Filter policies

Select "Topic 1" from the list of possible topics by clicking Topics in the Amazon SNS console.

You may now examine the SQS queues subscribing to this subject from the "Topic 1" information page. A sample screen is seen below.

  • After choosing each queue, click on ‘Edit’ to view the "Edit subscription" column, when you can modify the queue's filter policy.
  • Insert the code for JSON using the JSON editor
  • The changes need to be saved after doing them.
  • For the rest of the 2 queues, redo the above mentioned procedures. Because Queue 3 accepts all incident messages broadcast to the main subject, you don't need to specify any filter policies for it.

4.Publishing Messages

Click "Publish a message" on "Topic 1" page on the SNS dashboard.

Fill out the "Publish message’ page with the information for the message below.

Message subject is contained in the subject field, which is optional.

  • Keep selecting option "Identical payload for all delivery protocols."
  • contains the message's body, which is what will be delivered to the destination.
  • The variables present inside the message are contained in the message attributes. Type "String" for our example. Request type is the Name, and type 1 is the Value.

Post your initial message.

Follow the same procedure as before to add 2 more new messages described as Message #2 as well as Message #3 having the same specifications. Set the Value property for both the messages to "type 2."

5.Verifying the message delivery

The following step is to confirm that the new messages are being forwarded using the policy for message filtering to the appropriate SQS queue.

Choose your queue and then Queue Actions followed by View/ or Delete Messages from the Amazon SQS console.

To begin receiving the messages, click "Start Polling for Messages."

For the remaining lines, repeat the previous procedure.

Top 30 frequently asked AWS Interview Questions !

AWS Training

Weekday / Weekend Batches

Conclusion

You can send the appropriate messages to endpoints or subscribers by using Amazon SNS. It is a scalable and highly available service for pushing messages to microservices, distributed applications, as well as server less apps using the publisher-subscriber approach.

Related Articles

Find our upcoming AWS Training Online Classes

  • Batch starts on 1st Apr 2023, Weekend batch

  • Batch starts on 5th Apr 2023, Weekday batch

  • Batch starts on 9th Apr 2023, Weekend batch

Global Promotional Image
 

Categories

Request for more information

Amani
Amani
Research Analyst
As a content writer at HKR trainings, I deliver content on various technologies. I hold my graduation degree in Information technology. I am passionate about helping people understand technology-related content through my easily digestible content. My writings include Data Science, Machine Learning, Artificial Intelligence, Python, Salesforce, Servicenow and etc.

.

Protected by Astra Security