How to configure email notification using SNS
Welcome to CloudAffaire and this is Debjeet.
In the last blog post, we have discussed AWS RDS Multi-AZ deployment.
In this blog post, we will discuss how to configure email notification using SNS.
What is SNS?
Simple Notification Service or SNS is a web service that sends messages from publisher to subscriber. A publisher can be any event source like CloudWatch or CloudTrail and a subscriber can be SMS, email, http\https endpoints, lambda, SQS etc. Publisher act as message source and subscriber as destination and SNS coordinate the message delivery from source to destination.
When using Amazon SNS, you create a topic and control access to it 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. Instead of including a specific destination address in each message, a publisher sends a message 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. Each topic 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.
How to configure email notification using SNS:
Step 1: Login to AWS console and navigate to ‘SNS’.
Step 2: Provide a topic name and click ‘Next step’.
Step 3: Provide a display name and click ‘Create topic’.
Note: You can provide additional configurations like encryption, policy, logging, and tagging for your SNS topic.
Our SNS topic successfully created.
Next, we are going to create a subscriber for this topic.
Step 4: In the SNS topic page, click on ‘Subscriptions’ tab and then click ‘Create subscription’.
Step 5: Select your SNS topic ARN and provide protocol and endpoint details for an email subscription. Click ‘Create subscription’.
Our SNS subscription successfully created.
Note: In order to use this subscription, you need to confirm the subscription first to prove that the email account belongs to you.
Step 6: Login to the email account that you have provided and click on ‘Confirm subscription’.
Our email subscription for the SNS topic confirmed successfully.
Hope you have enjoyed this article. We are ready to use this SNS topic for email notification. Next, you need to integrate this SNS topic with a publisher and subscriber. We have already covered several use cases of this integration in previous blogs which you can go through.
To get more details on AWS SNS, please refer below AWS documentation