Simple Notification Service (SNS) in AWS
Amazon Web Services Simple Notification Service (AWS SNS) is a web service that automates the process of sending notifications to the subscribers attached to it. SNS provides this service to both application-to-person and application-to-application. It uses the publishers/subscribers paradigm for the push and delivery of messages. The data loss is prevented by storing the data across multiple availability zones. It is cost-efficient and provides low-cost infrastructure, especially to mobile users. It sends the notifications through SMS or email to an Amazon Simple Queue Service (SQS), AWS lambda functions, or an HTTP endpoint. When the CPU utilization of an instance goes above 80%, the AWS cloudwatch alarm is triggered. This cloudwatch alarm activates the SNS topic hence notifying the subscribers about the high CPU utilization of the instance. SNS service has a topic that has a unique name. It acts as a logical access point and the communication channel between publishers and subscribers.
Benefits of using SNS
- SNS increases Durability.
- SNS increases Security.
- SNS ensures accuracy.
- SNS reduces and simplifies the cost.
- SNS supports SMS in over 200 countries.
Clients of SNS
- Publishers: They communicate with subscribers in an asynchronous manner by producing and sending a message to a topic (i.e a logical access point and communication channel). They do not include a specific destination (ex – email id) in each message instead, send a message to the topic. They only send messages to topics they have permission to publish.
- Subscribers: Subscribers like web servers, email addresses, Amazon SQS queues, and AWS Lambda functions receive the notification over one of the supported protocols like Amazon SQS, HTTP/S, email, SMS, Lambda) when they are subscribed to the topic. 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.
Steps to create Simple Notification Service in AWS
Step 1: Go to the Amazon SNS dashboard. Click on Create Topic button.
Step 2: Type in the name of the topic and description( optional )
Step 3: Type in the key-value of the tag which is completely optional. Click on create the topic.
Step 4: Congratulations!! The topic is created successfully.
Step 5: Go back to the SNS dashboard. The created topic is visible in the dashboard now. Click on the link to the topic.
Step 6: You will be redirected to this page. Under subscription options, Click on Create subscription.
Step 7: Select the Protocol of the topic as Email and endpoint of the topic as your email id. Click on create subscription.
Step 8: Now go to the mailbox of the mentioned email id and click on Confirm subscription.
Step 9: You will be directed to this page. Your subscription is confirmed.