cloudg (cloud graphing) maps AWS, Azure and GCP infrastructure into a graph,
runs security scanners over the same inventory, and turns the results into reports you can actually use.
One command collects assets from every configured provider in parallel, feeds them through a NetworkX graph for reachability and attack path analysis, fans out to Prowler, ScoutSuite, Checkov and Trivy, then merges and deduplicates all findings against 28 compliance frameworks. Out the other end come an interactive HTML report, GraphML, an RDF ontology, RAG chunks for LLM pipelines, and Terraform files that recreate the live infrastructure.
Quick start
git clone https://github.com/morpheuslord/cloudg.git
cd cloudg
uv venv && source .venv/bin/activate
uv pip install -e ".[all,dev]"
# one provider, one region
cloudg run -p aws --regions us-east-1
# everything, everywhere
cloudg run -p all --regions all
# with Terraform recreation files
cloudg run -p aws --regions us-east-1 --terraform
Reports land in ./reports. Open report.html first.
Other install options (pip, Docker, installer scripts)
Plain pip works too: pip install -e ".[all]". The cloud SDKs are extras, so pip install cloudg[aws] pulls only boto3/aioboto3, [azure] and [gcp] do the same for their SDKs, and [all] installs the lot. The core package with no extras still gives you the graph engine, the ontology, the normaliser and the report renderers.
The external scanners (Prowler, Checkov, Trivy, ScoutSuite) are separate executables, not Python dependencies. install.sh (Linux/macOS) and install.bat (Windows) set up everything including the scanners and the cloud CLIs.
Docker is the lazy path, since the image bundles all four scanners:
docker build -t cloudg:latest .
docker compose run --rm cloudg run -p aws --regions us-east-1
Authentication
Every provider supports several auth methods, resolved in a fixed priority order. The same config works on a laptop, in CI, and on cloud compute. The full set of fields lives in config.yaml with comments for each method.
AWS
- Direct keys:
--aws-key/--aws-secret(plus--aws-session-tokenfor temporary credentials), or the standard env vars. - OIDC web identity federation:
--aws-role-arntogether with--aws-web-identity-token-file. This is the GitHub Actions / GitLab CI / EKS service account pattern, no long-lived keys anywhere. - A named CLI profile via
--profile, including SSO profiles. - Nothing at all: the default chain picks up env vars, cached SSO credentials, or the EC2/ECS instance role, so a scan running on cloud compute inherits its host's role.
On top of any of these you can layer STS role assumption with --aws-role-arn and, for the third-party auditor pattern, --aws-external-id. Multi-account fan-out uses accounts plus role_name in the config file, and cloudg assumes that role in each account before collecting.
Azure
- Workload identity federation:
--azure-tenant-id,--azure-client-idand--azure-federated-token-file(AKS workload identity, GitHub OIDC). - Service principal with a client secret:
--azure-client-secret. - Service principal with a certificate:
--azure-cert-path. - Managed identity:
--azure-managed-identity, withmanaged_identity_client_idin the config for user-assigned identities. - The DefaultAzureCredential chain, which also covers
az loginsessions.
GCP
- A credentials file via
--gcp-credentials-file: either a service account key JSON or a workload identity federation (external_account) config. - Application default credentials:
GOOGLE_APPLICATION_CREDENTIALS, gcloud user credentials, or the GCE/GKE metadata server.
--gcp-impersonate-sa layers service account impersonation on top of either, which is handy when your user account may impersonate a read-only scanner service account.
What the pipeline does
graph LR
A[Collect<br/>AWS + Azure + GCP] --> B[Graph<br/>reachability, attack paths]
A --> C[Scanners<br/>Prowler, Checkov, Trivy, ScoutSuite]
B --> D[Ontology + RAG + Terraform]
C --> E[Normalise<br/>dedupe, score, map to frameworks]
D --> F[Reports]
E --> F
Collection runs all providers concurrently with asyncio, iterating accounts and regions per provider (regions are auto-discovered when you pass --regions all). Assets and network edges go into a directed graph, where BFS from the internet node finds exposed resources and blast radius scoring estimates what an attacker could reach from each node.
The same inventory feeds three other exports. The ontology module infers about 62 typed relations (exposed_to_internet, assumes_role, encrypted_by, hosted_in_vpc and so on) and writes RDF you can query with SPARQL. The RAG exporter chunks the graph three ways (per asset, per Louvain community, per relation domain) into JSONL for retrieval pipelines. The Terraform exporter maps 25+ asset types to .tf.json resources with an import.sh to adopt them into state.
Scanner findings are deduplicated by resource and title, rescored against CVSS, and mapped to compliance controls.
Compliance rules
Findings are tagged with framework controls in four tiers, most precise first:
- Whatever the scanner itself reports (Prowler ASFF, Checkov check IDs).
- Exact check-ID lookup against the shipped rulesets. These are generated from Prowler's public compliance data (Apache-2.0) and cover 28 frameworks with 4,166 controls and 10,236 check mappings across AWS, Azure and GCP: CIS 5.0 for each cloud, NIST 800-53 rev 5, NIST CSF 2.0, PCI DSS 4.0, SOC 2, HIPAA, GDPR, ISO 27001:2022, MITRE ATT&CK, and the AWS Foundational Security Best Practices.
- Regex pattern rules for scanners that emit no compliance metadata.
- A small built-in fallback table.
Refreshing and extending the rulesets
The rulesets ship inside the package (cloudg/rules/). To refresh them against a newer Prowler release:
git clone --depth 1 https://github.com/prowler-cloud/prowler /tmp/prowler
python scripts/import_prowler_compliance.py /tmp/prowler
Adding your own framework is a YAML file in the rules directory:
framework: MY-FRAMEWORK
controls:
- id: "MF-1.1"
title: "Storage is encrypted"
patterns: ["encrypt.*rest"] # regex tier
checks: ["s3_default_encryption"] # exact tier, optional
cloudg/policies/ additionally holds Cloud Custodian policy packs (AWS governance, AWS security, Azure, GCP) you can run with custodian run independently of cloudg.
Reference
CLI flags
| Flag | Meaning |
|---|---|
-p, --provider |
aws, azure, gcp or all; repeatable |
--regions |
all for auto-discovery, or a comma-separated list |
--aws-key, --aws-secret, --aws-session-token |
direct AWS credentials |
--aws-role-arn, --aws-external-id |
STS role assumption |
--aws-web-identity-token-file |
OIDC token file for web identity federation |
--profile |
AWS CLI profile |
--subscription-id, --azure-tenant-id, --azure-client-id |
Azure identity |
--azure-client-secret, --azure-cert-path |
service principal credentials |
--azure-federated-token-file, --azure-managed-identity |
federation / managed identity |
--project-id, --gcp-credentials-file, --gcp-impersonate-sa |
GCP identity |
--scanners |
comma-separated subset of prowler,scoutsuite,checkov,trivy,iam |
--iac-dir |
directory for Checkov to scan |
--images |
container images for Trivy |
--ontology/--no-ontology |
RDF ontology export (on by default) |
--rag-export/--no-rag-export |
RAG chunk export (on by default) |
--terraform/--no-terraform |
Terraform recreation (off by default) |
-o, --output |
output directory, ./reports by default |
cloudg collect and cloudg scan run the individual phases; cloudg report -i findings.json re-renders reports from a previous run.
Output files
| File | What it is |
|---|---|
report.html |
interactive report, D3 topology plus findings table, works offline |
findings.json |
all findings, assets, edges and compliance results |
topology.svg, topology.graphml, topology-cytoscape.json |
the graph in three formats |
ontology.ttl, ontology.jsonld |
the RDF ontology |
rag_chunks.jsonl, rag_metadata_index.json |
retrieval-ready chunks |
terraform/*.tf.json, terraform/import.sh |
recreation files |
Using it as a library
from cloudg import CloudGConfig, CloudGEngine
config = CloudGConfig(providers=["aws"])
config.aws.role_arn = "arn:aws:iam::123456789012:role/scanner"
config.aws.external_id = "my-external-id"
engine = CloudGEngine(config)
engine.on_finding = lambda f: forward_to_siem(f)
result = engine.run_pipeline_sync()
print(result.to_summary())
The engine exposes collect(), scan() and analyze() separately if you only need part of the pipeline, and event hooks (on_finding, on_phase_start, on_error, on_scan_complete) for streaming integration.
Custom collectors and scanners register through entry points, no core changes needed:
[project.entry-points."cloudg.collectors"]
mycloud = "my_package.collector:MyCollector"
Development
uv pip install -e ".[all,dev]"
pytest # 152 tests, moto-mocked AWS included
ruff check cloudg/ tests/
uv build # wheel + sdist for PyPI
Python 3.11 or newer. The moto/aiobotocore incompatibility around async response bodies is handled in tests/conftest.py, so the suite runs against current versions of both.
License
MIT
Release files for cloudg 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cloudg-0.3.0.tar.gz | 268.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cloudg-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 581.3 kB
Release files / cloudg-0.3.0.tar.gz
| Download URL | cloudg-0.3.0.tar.gz |
|---|---|
| Size | 268.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecd6c309d64ba43fd1b5f46b9fc36ed7dd435317201a2f0729c1e48871fb593d
|
|
BLAKE2b-256 checksum How to use checksums |
ba5cd7594db3a94ef59c8374e9555f51eee53924ee8da59d0cc917cc067772b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 26, 2026.
Transparency logRelease files / cloudg-0.3.0-py3-none-any.whl
| Download URL | cloudg-0.3.0-py3-none-any.whl |
|---|---|
| Size | 312.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92778b52e33ba4a0b4be2a54b34da2710285aaa67baff81a832986a8f6de986d
|
|
BLAKE2b-256 checksum How to use checksums |
adcd652ca1c04f8286a5c3a19d16757564baf85959e272cd4af4a00175742f75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 26, 2026.
Transparency log