Passa a Pro

How to Create an SNS Alert on AWS

In this hands-on exercise, you will learn how to send alerts via SNS by creating a topic, subscribing to a topic, and publishing an alert message to a topic.

What is SNS

Amazon Simple Notification Service (SNS) is a cloud service that allows you to send notifications to the users of your applications. SNS allows you to decouple the notification logic from being embedded in your applications and allows notifications to be published to a large number of subscribers.

Features

  • SNS uses a publish/subscribe model.
  • SNS can publish messages to Amazon SQS queues, AWS Lambda functions, and HTTP/S webhooks.
  • SNS Topic names are limited to 256 characters.
  • A notification can contain only one message.

Prerequisites

· AWS Account

Topics Covered

By the end exercise, you will be able to:

· Create a topic

· Subscribe to a topic

· Publish a message on a topic

STEP 1:

Create a Topic:

  1. On the AWS Management Console page, type SNS in the Search box and select Simple Notification Service. The SNS Dashboard appears.

2. On the left-hand menu, click on Topics and then Create Topic.

3. Enter a name for your topic in the Name field.

4. In the Access policy — optional section, for the Define who can publish messages to the topic section, ensure Everyone is selected allowing anyone to publish to the topic. For the Define who can subscribe to this topic section, ensure Everyone is selected.

5. Click Create Topic. The topic screen will display.

STEP 2:

Subscribe to a Topic:

  1. Click on Subscription on the left menu and click on Create Subscription.

2. For the Protocol field, select Email and for the Endpoint, enter the email that should receive the notifications and click on Create Subscriptio.

3. The subscription page will display and the status will be Pending confirmation. After your subscription is created, you must confirm it.

4. In your email client, check the email address that you provided for the Endpoint and choose Confirm subscription in the email from Amazon SNS. In your web browser, a subscription confirmation screen appears. After the confirmation, the status will change from pending to confirmed.

STEP 3:

Publish a Message to a Topic

  1. From the menu on the left-hand side, click on Topics, select the topic you created earlier and then click Publish message.

2. Enter a subject in the Subject field. Enter a value in the Message body to send to the endpoint box in the Message body section. Scroll down and click Publish message.

3. In your email client, read the email from Amazon SNS.

You have learned how to create a simple notification service in AWS. For more information about SNS click on this documentation link.

link-up with me on Linkedin.

Like
1