Amazon Web Services (AWS) - List Simple Notification Service (SNS) Topics 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
And here is an example of how to limit the output using the --query option.
aws sns list-topics --query 'Topics[?TopicArn==`arn:aws:sns:us-east-1:12345679012:my-topic`]'
Something like this should be returned if you have not yet created any Topics.
{
"Topics": []
}
On the other hand, if you have created one or more Topics, something like this should be returned.
{
"Topics": [
{
"TopicArn": "arn:aws:sns:us-east-1:123456789012:my-topic"
}
]
}
Did you find this article helpful?
If so, consider buying me a coffee over at