Amazon SNS Explained

  • Post category:Solutions
  • Reading time:4 mins read

Amazon SNS is a powerful tool for sending notifications to mobile devices, pagers, and email addresses. With this service you can send messages from your AWS account that will be delivered as SMS text messages or emails. This post includes tutorials on how to set up an Amazon SNS notification using either the AWS Management Console.

What is Amazon SNS?

  • Amazon SNS is a simple way to receive and send notifications via the cloud. “Push” mechanisms are used for delivering messages using the publish-subscribe (pub-sub) messaging paradigm.
  • Using Amazon SNS, you can publish a message to an SNS topic. You have many options for how the notification will be delivered – HTTP(S) endpoints using webhooks, email, or SMS are just some examples of what’s available.
  • Amazon SNS is a system that enables AWS-hosted applications to send notifications of various events.
  • “It’s most useful for sending out all the different messages and updates about your apps,” says Jackson, “and it lets you share information easily between microservices.”

How does Amazon SNS work?

It’s easier than ever to send notifications from the cloud with Amazon SNS. With a publisher, you can push messages directly out via different avenues like email and text message! Users subscribe by sending an “interest” that determines what type of notification they want sent in their inboxes or phones. They’ll get these updates automatically because there is no queueing required – unlike services such as Amazon SQS, which require periodic checking before pushing your information to receivers.

  It’s time to get hands-on with AWS SNS

  • Log in to the AWS Management Console
  • In search bar, type “SNS.”
  • We will create our first topic
  • We will call it as “MyFirstTopic.”

aws sns

  • Click on Next step
  •  So, we have 2 options for creating a topic. It can either be a Standard topic and this we will be creating, or we can create FIFO
  •  We will go ahead with the Standard topic, and we have given it a name as MyFirstTopic.

Amazon SNS

 

We can Encrypt the topic, and we can add Access Policy which can define who and what can be written on the SNS topic

  • This is similar to S3 bucket policy and also similar to an SQS access policy
  • So, we could also setup an S3 bucket to write events to an SNS topic, and then SNS topic could send data to an SQS
  • So, an Access policy would be needed to allow the S3 bucket to write to our SNS topic
  • For now, we will choose Basic Policy
  • Scroll down and leave the below options as default 
  • Click on Create Topic
  • MyFirstTopic is created, and we can see we have 0 subscriptions

 

amazon sns

  • So, we need to create our first subscription
  • Click on Create subscription
  • For Protocol, we will select Email from the list
  • In the Endpoint, you can give your email address to receive notifications

aws sns topic

  • In Subscription Policy, we could filter the messages to the subscription if we have many subscribers but leave it as for now.
  • Click on Create subscription.
  • Our subscription is created, and now we need to validate it.
  • As we can see subscription is in the Pending state right now.

sns topic

  • So, to confirm it go to the email you provided, and you will see an email from AWS SNS
  • Click on Confirm Subscription and refresh the page, and you will see the status as confirmed
  • Again, if we look into our Subscription, we can see that it is going to send an email to the endpoint
  • Now let’s test it
  • Click on Publish message

amazon simple notification service

  • Scroll down and just type “hello world”, which is very common when we do tests.

amazon simple notification service

  • So, the message has been published into MyFirstTopic
  • Now, if we go to email, we can see that a message from AWS configuration straight coming hello world
  • So, it is confirmed that SNS is working for us

So, if you want to set up SQS, you can choose SQS from the protocol and set up many-many different queues as the receiver for the subscription of our SNS topic.

Congratulations!! You have successfully created amazon simple notification service.

The AWS blog tackles a range of topics, from how to use EC2 instances with Windows and Linux operating systems for your web apps through the best practices you should consider when building an app on Amazon Web Services.

Conclusion:

Amazon SNS is a powerful tool for sending notifications to mobile devices, pagers, and email addresses. With this service you can send messages from your AWS account that will be delivered as SMS text messages or emails. This post includes tutorials on how to set up an Amazon SNS notification using either the AWS Management Console.

Find out more about the world’s most popular cloud computing platform by visiting our other blogs!

Leave a Reply