aws-sns
Manage and interact with Amazon SNS
TLDR
List all objects of a specific type
Create a topic with a specific name and show its Amazon Resource Name (ARN)
Subscribe an email address to the topic with a specific ARN and show the subscription ARN
Publish a message to a specific topic or phone number and show the message ID
Delete the subscription with a specific ARN from its topic
Create a platform endpoint
Add a statement to a topic's access control policy
Add a tag to the topic with a specific ARN
SYNOPSIS
aws sns <subcommand> [global-options] [<subcommand-options>]
PARAMETERS
add-permission
Adds permissions to a topic policy
check-if-phone-number-is-opted-out
Checks if phone number is opted out of SMS
confirm-subscription
Confirms a subscription with token
create-platform-application
Creates platform application for push notifications
create-platform-endpoint
Creates endpoint for platform application
create-sms-sandbox-phone-number
Adds phone number to SMS sandbox
create-topic
Creates SNS topic (standard or FIFO)
delete-endpoint
Deletes platform endpoint
delete-platform-application
Deletes platform application
delete-sms-sandbox-phone-number
Removes phone number from SMS sandbox
delete-topic
Deletes topic and all subscriptions
get-data-protection-policy
Retrieves data protection policy
get-endpoint-attributes
Gets endpoint attributes
get-platform-application-attributes
Gets platform application attributes
get-sms-attributes
Gets SMS attributes
get-sms-sandbox-account-status
Gets SMS sandbox status
get-subscription-attributes
Gets subscription attributes
get-topic-attributes
Gets topic attributes
list-endpoints-by-platform-application
Lists endpoints for platform app
list-origination-numbers
Lists origination phone numbers
list-phone-numbers-opted-out
Lists opted-out phone numbers
list-platform-applications
Lists platform applications
list-sms-sandbox-phone-numbers
Lists SMS sandbox phone numbers
list-subscriptions
Returns all user's subscriptions
list-subscriptions-by-topic
Lists subscriptions for a topic
list-tags-for-resource
Lists tags for SNS resource
list-topics
Returns all user's topics
opt-in-phone-number
Opts in phone number for SMS
publish
Publishes message to topic, phone, or endpoint
put-data-protection-policy
Sets data protection policy
remove-permission
Removes permissions from topic policy
set-endpoint-attributes
Sets endpoint attributes
set-platform-application-attributes
Sets platform app attributes
set-sms-attributes
Sets SMS attributes
set-subscription-attributes
Sets subscription attributes
set-topic-attributes
Sets topic attributes
subscribe
Creates subscription to topic
tag-resource
Adds tags to SNS resource
unsubscribe
Deletes subscription
verify-sms-sandbox-phone-number
Verifies SMS sandbox phone number
--cli-input-json
Input as JSON file
--generate-cli-skeleton
Generates JSON skeleton
--output text|table|json
Output format
--region REGION
AWS region
--profile PROFILE
CLI profile name
DESCRIPTION
aws sns is the Amazon Web Services Command Line Interface (CLI) command for interacting with Amazon Simple Notification Service (SNS), a fully managed publish/subscribe messaging service. SNS enables decoupling and scaling of microservices, distributed systems, and serverless applications by fanning out messages to large numbers of subscribers simultaneously.
It supports multiple protocols including HTTP/S, email, SMS, application push notifications (via FCM, APNS), and AWS services like Lambda, SQS, and HTTP endpoints. Key capabilities include topic management, subscription handling, message publishing, dead-letter queues, FIFO topics for ordering, and SMS sandbox for testing.
The command requires the AWS CLI (version 1 or 2) installed and configured with valid credentials via aws configure, IAM permissions for SNS actions, and specification of a region (default us-east-1). It supports JSON/text output, pagination for list operations, and dry-run modes. Common workflows: create topics, subscribe endpoints, publish messages for notifications/alerts, monitor via CloudWatch. Integrates seamlessly with other AWS CLI commands for automation scripts, CI/CD pipelines, and infrastructure as code.
For full details, run aws sns help or aws sns COMMAND help. Handles high-throughput (millions of messages/sec) with at-least-once delivery guarantees.
CAVEATS
Requires AWS CLI installed/configured; IAM permissions needed; SMS limited by sandbox in most accounts; costs apply for messages/subscriptions; no aws-sns standalone binary—use aws sns.
COMMON EXAMPLES
Create topic: aws sns create-topic --name MyTopic
Publish message: aws sns publish --topic-arn arn:aws:sns:us-east-1:123456789012:MyTopic --message 'Hello!'
Subscribe email: aws sns subscribe --topic-arn arn... --protocol email --notification-endpoint user@example.com
CONFIGURATION
Run aws configure for credentials. Specify --region for non-default. Use IAM roles on EC2.
HISTORY
Introduced in AWS CLI v1 (2013) alongside SNS launch (2010). Enhanced in v2 (2020) with better performance, Markdown help. SNS evolved with FIFO (2018), SMS sandbox (2021), data protection policies.


