Created
October 11, 2022 19:06
-
-
Save brunocasarotti/6f60d3900c99c118b7a049a8b55883a5 to your computer and use it in GitHub Desktop.
Monitor number of messages in SQS queues using AWS CLI bash script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| queues=( | |
| "queue-1" | |
| "queue-2" | |
| ) | |
| for i in "${queues[@]}" | |
| do | |
| aws --profile MY-PROFILE sqs get-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/00000000000000000/$i --attribute-names ApproximateNumberOfMessages \ | |
| | grep ApproximateNumberOfMessage \ | |
| | tr -d \" \ | |
| | awk -v queuename=$i -F: '{print queuename $2}' | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment