Simple Notification Service (SNS) in AWS
Amazon Web Services Simple Notification Service (AWS SNS) is a web service that automates the process of sending the notifications to the subscribers attached to it. It uses the publishing/subscribe 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 also sends the notifications through SMS or email to an Amazon Simple Queue Service (SQS) or an HTTP endpoint. When the CPU utilization of instance goes above 80%, the AWS cloudwatch alarm is triggered. This cloudwatch alarm activates the SNS topic hence notifying the subscribers about high CPU utilization of 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.
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, sends a message to the topic. They only send messages to topics they have permission to publish to.
- Subscribers: Subscribers like web servers, email addresses, Amazon SQS queues, 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.