Amazon Web Services (AWS) - List Subscriptions to a Simple Notification Service (SNS) Topic using the AWS CLI

by
Jeremy Canfield |
Updated: April 15 2024
| Amazon Web Services (AWS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
A Simple Notification Service (SNS) Topic can be used to create notification alerts, such as an email notification. This uses the messaging services pub sub model.
- pub (publish) - create a new alert in a Topic
- sub (subscribe) - get alerts in a Topic
The aws sns list-topics command can be used to list your Simple Notification Service (SNS) Topics.
aws sns list-topics
Something like this should be returned.
{
"Topics": [
{
"TopicArn": "arn:aws:sns:us-east-1:123456789012:myTopic.fifo"
}
]
}
And the aws sns list-subscriptions command can be used to list the subscriptions to the topic. In this example, John Doe is subscribed to the topic, so John Doe should get an email when a message is put on the topic.
~]$ aws sns list-subscriptions
{
"Subscriptions": [
{
"SubscriptionArn": "arn:aws:sns:us-east-1:123456789012:mytopic:0f8966a4-1bf9-48fa-8564-5b4ecab489c2",
"Owner": "123456789012",
"Protocol": "email",
"Endpoint": "john.doe@example.com",
"TopicArn": "arn:aws:sns:us-east-1:123456789012:mytopic"
}
]
}
Did you find this article helpful?
If so, consider buying me a coffee over at