Skip to main content

CMQ

Cloud Multi Query (CMQ) is a Python library & CLI tool that allows you to run the same query across multiple cloud accounts in parallel, making it easy to gather insights and manage multi-account environments efficiently.

So far, CMQ only supports AWS cloud accounts. However, the plugable structure of CMQ allows for the creation of new session and resource types to include other cloud providers.

Installation

pip install cmq

Basic usage

CMQ works using profiles defined in your local machine (AWS CLI configuration). It's expected that every profile defines the access to an account/region.

Let's start listing the configured profiles:

cmq 'profile().list()'
[
   {
    "name": "account_a",
    "region": "us-east-1"
  },
  {
    "name": "account_b",
    "region": "eu-west-1"
  }
]

We can list resources for these accounts. CMQ will execute the queries in parallel. For example, lets list RDS resources:

cmq 'profile().rds().list()'
[
 {
    "DBInstanceIdentifier": "account-a-users",
    "DBInstanceClass": "db.m6g.large",
    "Engine": "postgres",
    ...
 },
 {
    "DBInstanceIdentifier": "account-b-users",
    "DBInstanceClass": "db.m6g.large",
    "Engine": "postgres",
    ...
 },
 ...
]

We can also use cmq as a Python library. This is more convenient when you need to process the results:

>>> from cmq.aws.session.profile import profile
>>> profile().sqs().list()
[
 {"resource": "https://sqs.us-east-1.amazonaws.com/123456789012/account-a-products"},
 {"resource": "https://sqs.us-east-1.amazonaws.com/123456789012/account-a-orders"},
 {"resource": "https://sqs.eu-west-1.amazonaws.com/210987654321/account-b-products"},
 {"resource": "https://sqs.eu-west-1.amazonaws.com/210987654321/account-b-orders"}
]

Enable verbose output

We can export the environment variable CMQ_VERBOSE_OUTPUT=true or use the option verbose in the CLI to output the progress of the query. This is particular useful when you have many accounts to process:

cmq --verbose 'profile().elasticache().list()'
 100.00% :::::::::::::::::::::::::::::::::::::::: |        1 /        1 |:  account-dev     elasticache
 100.00% :::::::::::::::::::::::::::::::::::::::: |        1 /        1 |:  account-test    elasticache
 100.00% :::::::::::::::::::::::::::::::::::::::: |        1 /        1 |:  account-prd1    elasticache
 100.00% :::::::::::::::::::::::::::::::::::::::: |        1 /        1 |:  account-prd2    elasticache
 100.00% :::::::::::::::::::::::::::::::::::::::: |        1 /        1 |:  account-prd3    elasticache
[
    ... resource list ...
]

Docs

Examples

List RDS resources in one profile with name account_a

cmq 'profile(name="account_a").rds().list()'

List SNS topics for all profiles, but returning a dictionary where the key is the name of the profile:

cmq 'profile().sns().dict()'
{
    "account_a": [
        ... topics from account a ...
    ],
     "account_b": [
        ... topics from account b ...
    ],
}

List all roles for all accounts, but return only the RoleName field:

cmq 'profile().role().attr("RoleName").list()'

List DynamoDB tables, but limit the results to 10 tables:

cmq 'profile().dynamodb().limit(10).list()'

CMQ uses boto3 to list/describe resources. You can also use the parameters of the boto3 functions to filter resources in the request. For example, this will list all SQS queues with prefix order in all accounts:

cmq 'profile().sqs(QueueNamePrefix="order").list()'

We can also filter resources in the response. CMQ is built with a set of quick filters that you can use with any resource type. All the filters have the same structure: __filter__(key, value)

For example, the following query list Lambda functions running with python3.10 in all accounts:

cmq 'profile().function().eq("Runtime", "python3.10").list()'

These are the supported quick filters:

  • eq
  • ne
  • in_
  • contains
  • not_contains
  • starts_with
  • ends_with
  • gt
  • lt

Supported resources

AWS

  • address
  • alarm
  • cloudformation
  • cloudtrail
  • dynamodb
  • ec2
  • elasticache_parameter_group
  • elasticache_replication_group
  • elasticache_subnet_group
  • elasticache
  • function
  • kinesis
  • kms_alias
  • kms
  • log_event
  • log_stream
  • log
  • metric
  • rds_parameter_group
  • rds
  • resource_explorer
  • resource_group
  • role
  • s3_object
  • s3
  • sns
  • sqs
  • user_key
  • user

Metadata

Release files for cmq 0.16.0

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

Source distribution (sdist)

Source distribution for cmq 0.16.0
File Size Uploaded Provenance Actions
cmq-0.16.0.tar.gz 24.5 kB With provenance Details for cmq-0.16.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cmq 0.16.0
File Interpreter ABI Platform Actions
cmq-0.16.0-py3-none-any.whl Python 3 none any Details for cmq-0.16.0-py3-none-any.whl

Total release size: 77.4 kB

Release files / cmq-0.16.0.tar.gz

Download URL cmq-0.16.0.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
dd26a6dd5eec6679b7d84c7f7b5dc037493b256b86a7ef564ea40d4932fee2bd
BLAKE2b-256 checksum
How to use checksums
956e846bfff940c381b1668233ce0af521d3d3439f384965d6cfa36164594e9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / cmq-0.16.0-py3-none-any.whl

Download URL cmq-0.16.0-py3-none-any.whl
Size 52.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b06b679593f11e056136fe2a8b1bc65a9d51a6484d294ec065e2e2a14021912
BLAKE2b-256 checksum
How to use checksums
35d3cfb23550ae33e597af0e349f4decfa96b67c26468d300d0757bcc95e0069
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for cmq 0.16.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cmq-0.16.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 release files Full provenance

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