Is there a way to list all of the AWS SNS topics that a particular SQS queue is subscribed to, using the AWS CLI?
I already know how to see the list of subscribers on an SNS topic, but that only works if I know the name of the SNS topic. In this case, I only know the name of the SQS queue.
I wasn't able to find anything by searching the interwebs.
To confirm the subscription, you can use the Amazon SQS console or the ReceiveMessage action. Before you subscribe an endpoint to the topic, make sure that the queue can receive messages from the topic by setting the sqs:SendMessage permission for the queue.
You can subscribe one or more Amazon SQS queues to an Amazon Simple Notification Service (Amazon SNS) topic. When you publish a message to a topic, Amazon SNS sends the message to each of the subscribed queues. Amazon SQS manages the subscription and any necessary permissions.
A single Amazon SQS message queue can contain an unlimited number of messages. However, there is a quota of 120,000 for the number of inflight messages for a standard queue and 20,000 for a FIFO queue.
SQS cannot publish messages to SNS. SQS can only store the messages. You have to pull the message using SQS Api's.
There is no such API for this purpose, so as a work around you can use SNS cli command aws sns list-subscriptions
and filter by your SQS arn (using a grep
command maybe). This approach may not be feasible depending on how many subscriptions exists on you account (results are paginated in a 100 items batch). You can filter subcriptions by topic to reduce results by using list-subscriptions-by-topic
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With