This is a post to myself. Due to a faulty application we have a lot of dead queues in AWS SQS. To get rid of them I wrote the following script that I executed in a container that has the AWS CLI installed
prefix="[your-prefix-here]"
queues=$(aws sqs list-queues --queue-name-prefix $prefix)
for q in ${queues[@]}
do
if [ "${q:0:1}" == "\"" ]; then
x=${q:1:${#q}-3}
if [ $x != "QueueUrls" ]; then
aws sqs delete-queue --queue-url $x
fi
fi
doneThe script is quick and dirty and deals with the fact that the AWS CLI returns the list of queues as a JSON array.