Search code examples
pythonfiltertagsboto3amazon-sqs

Filtering SQS queues based on tags in boto3


I have the code to filter the SQS queues based on the queue name prefix. But, now I want to filter the queues based on tags instead of "queue name prefix". Is there a way to do it in boto3?

Here is the code to filter the sqs queues based on their name prefix. This code returns all the SQS queues in my account that starts with the name "Queue"

import boto3
sqs = boto3.client('sqs')

response = sqs.list_queues(QueueNamePrefix = 'Queue')
queue_array = response["QueueUrls"]
print(queue_array)

Solution

  • I have used resource groups instead of directly using queues to filter them based on tags. It is easier this way.