Step 3: Confirm your Amazon SNS subscription - Amazon Simple Notification Service

Step 3: Confirm your Amazon SNS subscription

To confirm an AWS Amazon SNS subscription, follow these steps to ensure that your endpoint can successfully receive messages. This process involves setting up your endpoint to handle incoming confirmation messages, retrieving the necessary confirmation URL, and confirming the subscription through automated or manual means.

  1. Subscription confirmation message. After you subscribe your endpoint to an Amazon SNS topic, Amazon SNS sends a confirmation message to that endpoint. This message contains a SubscribeURL, which you need to confirm the subscription.

  2. Retrieve the SubscribeURL. Your endpoint should have code that listens for and processes incoming messages. This code must extract the SubscribeURL from the confirmation message. The confirmation message typically arrives as a JSON payload with the SubscribeURL key.

  3. Confirm the subscription. There are two ways to confirm the subscription:

    • Automatic confirmation. Your endpoint code can automatically visit the SubscribeURL to confirm the subscription. This approach requires your endpoint to make an HTTP GET request to the URL provided.

    • Manual confirmation. If automatic confirmation is not set up, you can manually visit the SubscribeURL using a web browser. This step involves copying the URL from the message and pasting it into your browser's address bar.

  4. Verify subscription status. Once you confirm the subscription by visiting the SubscribeURL, Amazon SNS sends a response that includes an XML document with an element called SubscriptionArn. This element contains the Amazon Resource Name (ARN) for the subscription, indicating that the subscription is active.

  5. Use the Amazon SNS console. You can also verify the subscription status using the AWS Management Console. Navigate to the Amazon SNS dashboard, and under the Subscriptions section, find your subscription. A confirmed subscription will display its ARN, whereas an unconfirmed subscription will show PendingConfirmation.