0

I am trying to check the health of our SQS queues using boto3 for python. The health will be evaluated using AWS's quotas for in-flight messages: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-queues.html.

I am guessing the code will look something like this, but haven't found anything online so far.

SQS = boto3.client('sqs')

# Get queue using the SQS object
# Check if the queue is FIFO or not
# Get amount of in-flight messages

Any help is appreciated!

Jack
  • 1
  • You can get it from the `ApproximateNumberOfMessagesNotVisible ` [CloudWatch metric](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-available-cloudwatch-metrics.html). – jellycsc Jul 28 '21 at 18:26
  • I doubt that value is exposed in a reasonable manner, it is probably available in the cloudwatch metric but not directly from sqs. What do you want to do based on the value anyway? Why do you no just set up cloudwatch alarms on the exported metrics? – luk2302 Jul 28 '21 at 18:26
  • @luk2302 I am trying to write a library for health checks to call from other services. Based on whether the in flight messages are more than 20,000/120,000 FIFO/non-FIFO, the library will return whether or not the SQS queue is in a healthy or degraded state. – Jack Jul 28 '21 at 18:43
  • You could do it the other way, where CloudWatch triggers the alert about it being unhealthy, rather than waiting for your code to run. – John Rotenstein Jul 28 '21 at 23:20

0 Answers0