Step 3: Confirm your Amazon SNS subscription
To confirm an Amazon 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.
-
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. -
Retrieve the
SubscribeURL
. Your endpoint should have code that listens for and processes incoming messages. This code must extract theSubscribeURL
from the confirmation message. The confirmation message typically arrives as a JSON payload with theSubscribeURL
key. -
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.
-
-
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 calledSubscriptionArn
. This element contains the Amazon Resource Name (ARN) for the subscription, indicating that the subscription is active. -
Use the Amazon SNS console. You can also verify the subscription status using the Amazon Web Services 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
.