Skip to main content

SQS List Filled Queues

A Python script that lists Amazon SQS queues containing messages and updates the display periodically. This tool leverages the boto3 library to interact with AWS SQS, making it easy to monitor your message queues.

Features

  • Lists all SQS queues with at least one message.
  • Displays the number of messages in each queue.
  • Optionally includes messages in flight (being processed) in the count.
  • Filters queues by name using regex patterns.
  • Provides direct links to the AWS SQS console for each queue.
  • Supports periodic updates to refresh the displayed information.
  • Configurable number of worker threads for fetching queue information.
  • Exits with error code 1 when messages are found (useful for monitoring/alerting).

Prerequisites

  • Python 3.x
  • AWS credentials configured (via environment variables, AWS config file, or IAM roles).

Usage

You can run the script directly from the command line. Here are some usage examples:

  • To list queues and display results once:

    sqs-list-filled-queues

  • To include messages in flight (being processed):

    sqs-list-filled-queues --include-in-flight

  • To watch the queues and refresh every 60 seconds:

    sqs-list-filled-queues --watch

  • To specify a custom refresh interval (e.g., 30 seconds):

    sqs-list-filled-queues --watch 30

  • To adjust the number of worker threads (e.g., 8):

    sqs-list-filled-queues --workers 8

  • To filter queues by name pattern (case-insensitive regex):

    sqs-list-filled-queues --pattern "prod" sqs-list-filled-queues --pattern "^test-" sqs-list-filled-queues --pattern "queue$"

  • To combine options (watch with in-flight messages and pattern filtering):

    sqs-list-filled-queues --watch 30 --include-in-flight --pattern "production"

Exit Codes

  • 0: No messages found in any queue
  • 1: At least one message found in one or more queues (useful for monitoring/alerting)

Controls During Watching

  • Press R to force a refresh.
  • Press Q to quit the program.

Pattern Filtering

The --pattern option allows you to filter queues by name using regular expressions. The pattern is applied to the queue name only (not the full URL) and is case-insensitive.

Examples:

  • --pattern "test" - matches queues containing "test" anywhere in the name
  • --pattern "^prod-" - matches queues starting with "prod-"
  • --pattern "queue$" - matches queues ending with "queue"
  • --pattern "(dev|test|staging)" - matches queues containing "dev", "test", or "staging"

Example Output

Without in-flight messages

Reading list of queues...Processed 5 out of 10 queues...
QueueName1: 12 msgs
    https://console.aws.amazon.com/sqs/v2/home?region=us-west-2#/queues/QueueName1
QueueName2: 5 msgs
    https://console.aws.amazon.com/sqs/v2/home?region=us-west-2#/queues/QueueName2

With in-flight messages (--include-in-flight)

Reading list of queues...Processed 5 out of 10 queues...
QueueName1: 12 msgs, 3 in-flight, 15 total
    https://console.aws.amazon.com/sqs/v2/home?region=us-west-2#/queues/QueueName1
QueueName2:  5 msgs, 0 in-flight,  5 total
    https://console.aws.amazon.com/sqs/v2/home?region=us-west-2#/queues/QueueName2

With pattern filtering (--pattern "prod")

Reading list of queues...Filtered 10 queues to 3 matching pattern 'prod'
Processed 3 out of 3 queues...
production-queue: 25 msgs
    https://console.aws.amazon.com/sqs/v2/home?region=us-west-2#/queues/production-queue
user-actions-prod:  8 msgs
    https://console.aws.amazon.com/sqs/v2/home?region=us-west-2#/queues/user-actions-prod

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for sqs-list-filled-queues 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqs-list-filled-queues 0.3
File Size Uploaded
sqs_list_filled_queues-0.3.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqs-list-filled-queues 0.3
File Interpreter ABI Platform
sqs_list_filled_queues-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / sqs_list_filled_queues-0.3.tar.gz

Download URL sqs_list_filled_queues-0.3.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
06d999e9132c027e18131c9da8c8a0161b2d160946b7de27301a4f0918a3e8ea
BLAKE2b-256 checksum
How to use checksums
72b778e529c41d39d46579605422c4b0402840de322c65aa381ed167eca61e07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / sqs_list_filled_queues-0.3-py3-none-any.whl

Download URL sqs_list_filled_queues-0.3-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
448515d508f8f26f2a7c8abe067d4f5e2eb671e30f6dfb80a1c8673ba5f776e6
BLAKE2b-256 checksum
How to use checksums
62f0eb20fb46d643ff83ec237a130de01b7a4023ec7846fcd9357bd0ff920bb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page