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

sns-publish

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

Sends a message to all endpoints that are subscribed to the topic.

Syntax

Copy
sns-publish TopicArn --message value [--subject value] [General Options]

Options

Name Description Required

TopicArn

The ARN of the topic you want to publish to.

Yes

Message

The text of the message, which must be UTF-8 compatible text and at most 4096 bytes long.

Yes

Subject

Optional parameter for the subject line in email notifications.

No

Output

This command returns a message identifier.

Examples

Example Request

This example sends the message "Hello, world!" to topic ARN arn:aws:sns:us-east-1:365928882516:Foo.

Copy
$PROMPT> sns-publish arn:aws:sns:us-east-1:365928882516:Foo --message "Hello, world!"

Example Response

Copy
MESSAGE ID 5c0919e1-cd47-4389-871a-8037f5f39efe