Skip to content

Instantly share code, notes, and snippets.

@alexandrerocco
Created September 6, 2021 13:44
Show Gist options
  • Save alexandrerocco/617f9be5ce6c493e4b848378396aff40 to your computer and use it in GitHub Desktop.
Save alexandrerocco/617f9be5ce6c493e4b848378396aff40 to your computer and use it in GitHub Desktop.
Deletes test or old AWS SQS queues that matches the prefix
prefix=your-queue-prefix"
region="your-region"
queues=$(aws sqs list-queues --queue-name-prefix $prefix --region $region)
for q in ${queues[@]}
do
if [ "${q:0:1}" == "\"" ]; then
x=${q:1:${#q}-3}
if [ $x != "QueueUrls" ]; then
aws sqs delete-queue --region $region --queue-url $x
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment