I have to list all the subscriptions in SNS, but aws sns list-subscriptions is listing only 100 queues unless we mention the option --max-items. Every time i've to manually check the no of SNS subscriptions to assign the right value.Is there anyway we can get the No of SNS subscriptions using AWS CLI, so that i can parse that value to next command in a script?
Asked
Active
Viewed 947 times
1 Answers
1
Isn't the SubscriptionsConfirmed
value from the aws sns get-topic-attributes
command what you are looking for?

Mark B
- 183,023
- 24
- 297
- 295
-
we have to parse --topic-arn for that command and it give attributes for specified arn only. I'm looking for total No of Subscriptions in my AWS account to parse that number to ***aws sns list-subscriptions --max-items*** – Bored Monkey Jan 31 '17 at 21:35
-
1It seems like it would be easier and more efficient to get a list of all SNS topics, and then loop through them getting the subscription number, than it would be to list every single subscription in every topic just to get a count. – Mark B Jan 31 '17 at 21:40
-
yeah, that is good way.But, aws sns list-subscriptions is listing only 100 subscriptions at a time. – Bored Monkey Jan 31 '17 at 22:07
-
@Jay That is by design -- you will have to use the paging functionalities of that API to iterate all subscriptions. – Anthony Neace Jan 31 '17 at 22:16
-
@Jay that's why I suggested the other approach. My approach seems easier than dealing with the pagination functionality in a shell script. – Mark B Jan 31 '17 at 22:18