Menu
Amazon Simple Notification Service
CLI Reference (API Version 2010-03-31)

sns-subscribe

The Amazon SNS CLI has been deprecated and is no longer supported. Please use the AWS Unified CLI or the AWS Tools for Windows PowerShell instead. To map the old SNS CLI commands to the AWS Unified CLI or PowerShell, see Migrating Amazon SNS CLI Commands to AWS CLI and PowerShell Commands.

Description

Subscribes an endpoint to a topic. If the chosen transport protocol requires confirmation, a message with a confirmation token is sent to the endpoint.

Syntax

Copy
sns-subscribe TopicArn --endpoint value --protocol value [General Options]

Options

Name Description Required

TopicArn

The ARN of the topic to which the endpoint should be subscribed.

Yes

--protocol

The protocol by which notifications should be delivered. Supported protocols include http, https, email, email-json, and sqs.

Yes

--endpoint

The endpoint to which notifications should be delivered. Endpoints vary by protocols and can be URLs, email addresses, or the Amazon Resource Name (ARN) of Amazon SQS queues.

Yes

Output

Returns a message indicating request was received.

Examples

Example Request

This example subscribes to topic ARN arn:aws:sns:us-east-1:365928882516:Foo, with an http protocol and an endpoint at http://www.example.com:8080.

Copy
$PROMPT> sns-subscribe arn:aws:sns:us-east-1:365928882516:Foo --protocol http --endpoint http://www.example.com:8080

Example Response

Copy
Subscription request received.