Amazon SNS
How to list Amazon SNS subscriptions for a topic
Use ListSubscriptionsByTopic to enumerate subscriptions for a known topic ARN. Use the AWS CLI when you want it to retrieve successive pages for you.
Documentation reviewed · 2 methods with sources
Ways to do it
API
ListSubscriptionsByTopic
Read the subscriptions for one topic ARN and use NextToken when the service returns another page.
Read source: Amazon SNS ListSubscriptionsByTopic API- Requirements
- A Signature Version 4 signed request from an AWS principal allowed sns:ListSubscriptionsByTopic on the topic, plus the topic ARN and its Region.
- Limitations
- Each request returns up to 100 subscriptions. Pass NextToken to get the next page.
Example text
GET /?Action=ListSubscriptionsByTopic&TopicArn=arn%3Aaws%3Asns%3Aus-east-1%3A111122223333%3Aexample-topic&Version=2010-03-31 HTTP/1.1
Host: sns.us-east-1.amazonaws.comCLI
aws sns list-subscriptions-by-topic
List subscriptions by ARN with automatic pagination in the AWS CLI.
Read source: AWS CLI list-subscriptions-by-topic- Requirements
- AWS CLI v2, credentials allowed sns:ListSubscriptionsByTopic on the topic, and the topic ARN and Region.
- Limitations
- --no-paginate returns only the first service page. If --max-items truncates output, resume using the CLI token with --starting-token.
Example shell
aws sns list-subscriptions-by-topic --region "$AWS_REGION" \
--topic-arn "$SNS_TOPIC_ARN" --output json