Amazon Simple Notification Service (SNS) is a web service that coordinates and manages the delivery of messages. It is a highly available, durable, secure, fully managed pub/sub messaging service. It uses cross availability zone message storage to provide high message durability. Amazon SNS also ensures that data is encrypted in transit. It is used to broadcast the messages of a message-producer system.

To receive messages published to an SNS topic, we must subscribe to an endpoint. We can have endpoints such as AWS Lambda, Amazon SQS, HTTP/S, or an email address to the topic we create. When we subscribe to an endpoint to a topic and confirm the subscription, the endpoint begins to receive messages published to the associated topic.

To understand the billing of SNS Topic, click here.

In this article, we will create an SNS Topic and subscribe to an Email Endpoint.

Pre-requisites

  1. AWS Account (Create if you don’t have one).

 What will we do?

  1. Login to AWS.
  2. Create an SNS Topic
  3. Create a Subscription in the SNS Topic

Login to AWS

Click here to go to AWS Login Page.

When we hit the above link, we will see a web page as follows where we are required to login using our login details.

<img alt="AWS Login" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123545_pm.png61d2ff849259f.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

Once you log in, you see the screen as follows.

<img alt="AWS Management console" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123607_pm.png61d2ff84b00d2.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

Create an SNS Topic

To create an SNS Topic, click on Services in the top left, search for SNS and open it.

<img alt="Create an SNS Topic" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123617_pm.png61d2ff850c258.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

You will see the main dashboard of the SNS Service. Here, click on Topics in the left Panel.

<img alt="Dashboard of the SNS Service" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123719_pm.png61d2ff852a685.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

On this page, click on the “Create topic” button to create your first SNS Topic

<img alt="Create topic" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123723_pm.png61d2ff854bc26.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

Give a name to the topic and click on “Create topic”. You can skip other fields.

<img alt="Topic details" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123744_pm.png61d2ff859f7f7.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

Create a Subscription in the SNS Topic

Once you have an SNS Topic, it’s time to create a Subscription. Open the topic we just created and you will see the page as follows. 

Under the Subscriptions tab, click on “Create subscriptions”.

<img alt="SNS Topic" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123749_pm.png61d2ff85b50f4.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

Choose the protocol as Email, specify your email address and click on “Create Subscriptions”.

<img alt="Create subscription" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123819_pm.png61d2ff85db2a6.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

Just creating a subscription is not enough. We need to confirm the subscription.

<img alt="Confirm subscription to SNS topic" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123840_pm.png61d2ff8600e88.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

Check your email inbox, you must have received a Subscription email.

Click on “Confirm subscription” to confirm the subscription.

<img alt="AWS Notification Subscription confirmation" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123907_pm.png61d2ff8653b0f.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

You will see the confirmation screen as follows.

<img alt="Subscription confirmed" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_124448_pm.png61d2ff866b80e.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="260" loading="lazy" src="data:image/svg xml,” width=”750″>

And now if you go to the Subscription screen, you can see that the Status has changed to “Confirmed” from “Pending confirmation”.

<img alt="AWS SNS Subscription" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/01/echo/screenshot_2020-05-20_at_123933_pm.png61d2ff8680eeb.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="468" loading="lazy" src="data:image/svg xml,” width=”750″>

Conclusion

In this article, we saw the steps to create an SNS Topic, create an Email Subscription and subscribe to it.

You can use the same steps to choose a different protocol for the subscription you want to create.