Menu
Amazon CloudWatch
User Guide

Set Up Amazon SNS Notifications

Amazon CloudWatch uses Amazon Simple Notification Service (Amazon SNS) to send email. First you create and subscribe to an SNS topic. When you create a CloudWatch alarm, you can add this SNS topic to send an email notification when the alarm changes state. For more information, see the Amazon Simple Notification Service Getting Started Guide.

Tip

Alternatively, if you plan to create your CloudWatch alarm using the AWS Management Console, you can skip this procedure because you can create the topic through the Create Alarm Wizard.

Set Up an SNS Topic Using the AWS Management Console

First you create a topic, then you subscribe to it. You can optionally publish a test message to the topic.

To create an SNS topic

  1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/.

  2. On the SNS dashboard, under Common actions, choose Create Topic.

  3. In the Create new topic dialog box, for Topic name, type a name for the topic (for example, my-topic).

  4. Choose Create topic.

  5. Copy the Topic ARN for the next task (for example, arn:aws:sns:us-east-1:111122223333:my-topic).

To subscribe to an SNS topic

  1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/.

  2. In the navigation pane, choose Subscriptions.

  3. On the Subscriptions page, choose Create subscription.

  4. In the Create subscription dialog box, for Topic ARN, paste the topic ARN that you copied created in the previous task.

  5. For Protocol, choose Email.

  6. For Endpoint, type an email address that you can use to receive the notification, and then choose Create subscription.

  7. From your email application and open the message from AWS Notifications and confirm your subscription.

    Your web browser displays a confirmation response from Amazon Simple Notification Service.

To publish a test message to an SNS topic

  1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/.

  2. In the navigation pane, choose Topics.

  3. On the Topics page, choose the topic, and then choose Publish to topic.

  4. In the Publish a message page, for Subject, type a subject line for your message, and for Message, type a brief message.

  5. Choose Publish Message.

  6. Check your email to confirm that you received the message.

Set Up an SNS Topic Using the AWS CLI

First you create an SNS topic, and then publish a message directly to the topic to test that you have properly configured it.

To set up an SNS topic

  1. Create the topic using the create-topic command as follows.

    aws sns create-topic --name my-topic

    Amazon SNS returns a topic ARN with the following format:

    {
        "TopicArn": "arn:aws:sns:us-east-1:111122223333:my-topic"
    }
  2. Subscribe your email address to the topic using the subscribe command. You will receive a confirmation email message if the subscription request succeeds.

    aws sns subscribe --topic-arn arn:aws:sns:us-east-1:111122223333:my-topic --protocol email --notification-endpoint my-email-address

    Amazon SNS returns the following:

    {
        "SubscriptionArn": "pending confirmation"
    }
  3. From your email application and open the message from AWS Notifications and confirm your subscription.

    Your web browser displays a confirmation response from Amazon Simple Notification Service.

  4. Check the subscription using the list-subscriptions-by-topic command.

    aws sns list-subscriptions-by-topic --topic-arn arn:aws:sns:us-east-1:111122223333:my-topic

    Amazon SNS returns the following:

    {
      "Subscriptions": [
        {
            "Owner": "111122223333",
            "Endpoint": "me@mycompany.com",
            "Protocol": "email",
            "TopicArn": "arn:aws:sns:us-east-1:111122223333:my-topic",
            "SubscriptionArn": "arn:aws:sns:us-east-1:111122223333:my-topic:64886986-bf10-48fb-a2f1-dab033aa67a3"
        }
      ]
    }
  5. (Optional) Publish a test message to the topic using the publish command.

    aws sns publish --message "Verification" --topic arn:aws:sns:us-east-1:111122223333:my-topic

    Amazon Simple Notification Service returns the following:

    {
        "MessageId": "42f189a0-3094-5cf6-8fd7-c2dde61a4d7d"
    }
  6. Check your email to confirm that you received the message.