Amazon Simple Notification Service
Developer Guide

Getting Started with Amazon SNS

This section helps you become more familiar with Amazon SNS by showing you how to manage topics, subscriptions, and messages using the AWS Management Console.

Prerequisites

Before you begin, complete the steps in Setting Up Access for Amazon SNS.

Step 1: Create a Topic

  1. Sign in to the Amazon SNS console.

  2. In the Create topic section, enter a Topic name, for example MyTopic.

  3. Choose Create topic.

    The topic is created and the MyTopic page is displayed.

    The topic's Name, ARN, (optional) Display name, and Topic owner's AWS account ID are displayed in the Details section.

  4. Copy the topic ARN to the clipboard, for example:

    arn:aws:sns:us-east-2:123456789012:MyTopic

Step 2: Create a Subscription for an Endpoint to the Topic

  1. On the navigation panel, choose Subscriptions.

  2. On the Subscriptions page, choose Create subscription.

  3. On the Create subscription page, do the following:

    1. Enter the Topic ARN of the topic you created earlier, for example:

      arn:aws:sns:us-east-2:123456789012:MyTopic

      Note

      To see a list of the topics in the current AWS account, choose the Topic ARN field.

    2. For Protocol, select an endpoint type, for example Email.

    3. For Endpoint, enter an email address that can receive notifications, for example:

      name@example.com

      Note

      After your subscription is created, you must confirm it. Only HTTP/S endpoints, email addresses, and AWS resources in other AWS accounts require confirmation. (Amazon SQS queues and Lambda functions in the same AWS account—as well as mobile endpoints —don't require confirmation.)

    4. Choose Create subscription.

      The subscription is created and the Subscription: 1234a567-bc89-012d-3e45-6fg7h890123i page is displayed.

      The subscription's ARN, Endpoint, Topic, Status (Pending confirmation at this stage), and Protocol are displayed in the Details section.

  4. In your email client, check the email address that you specified and choose Confirm subscription in the email from Amazon SNS.

  5. In your web browser, a subscription confirmation with your subscription ID is displayed.

Step 3: Publish a Message to the Topic

  1. On the navigation panel, choose Topics.

  2. On the Topics page, choose the topic you created earlier and then choose Publish message.

  3. On the Publish message to topic page, do the following:

    1. In the Message details section, enter the (optional) Subject, for example:

      Hello from Amazon SNS!
    2. In the Message body section, enter the message, for example:

      If you receive this message, publishing a message to an Amazon SNS topic works.
    3. In the Message attributes section, add any attributes that you want Amazon SNS to match with the subscription attribute FilterPolicy to decide whether the subscribed endpoint is interested in the published message. For more information, see Amazon SNS Message Attributes.

    4. Choose Publish message.

      The message is published to the topic and the MyTopic page is displayed.

      The topic's Name, ARN, (optional) Display name, and Topic owner's AWS account ID are displayed in the Details section.

  4. In your email client, check the email address that you specified earlier and read the email from Amazon SNS.

Step 4: Delete the Subscription and Topic

  1. On the navigation panel, choose Subscriptions.

  2. On the Subscriptions page, choose a confirmed subscription and then choose Delete.

    Note

    You can't delete a pending confirmation. After 3 days, Amazon SNS deletes it automatically.

  3. In the Delete subscription dialog box, choose Delete.

    The subscription is deleted.

  4. On the navigation panel, choose Topics.

  5. On the Topics page, choose a topic and then choose Delete.

    Important

    When you delete a topic, you also delete all subscriptions to the topic.

  6. On the Delete topic MyTopic dialog box, enter delete me and then choose Delete.

    The topic is deleted.

Next Steps

Now that you've created a topic and a subscription and learned how to send messages to a topic and how to delete a subscription and topic, you might want to try the following: