GCP Radar
GCP Resource Inventory Scanner & Architecture Diagram Generator
A Python CLI tool that inventories all your GCP resources and generates beautiful draw.io architecture diagrams.
Features
- 🔍 Inventory Scanning: Scans Compute Engine, Cloud SQL, Cloud Functions, GKE, Cloud Storage, Cloud Run, Firestore, Pub/Sub, and more
- 💰 Commitment Export: Pull every committed use discount (CUD) across a whole billing account to CSV
- 💵 Billing Export: Daily cost by service (last 90 days) from the Cloud Billing BigQuery export
- 📊 CSV Export: Export complete inventory to CSV for further analysis
- 🏗️ Architecture Diagrams: Auto-generate draw.io
.drawiofiles with logical service connections - ☁️ Multi-Project Support: Scan multiple GCP projects in one go
- 🔐 Service Account Auth: Use gcloud default credentials or specify service account key
Installation
pip install gcp-radar
Or from source:
git clone https://github.com/yourname/gcp-radar.git
cd gcp-radar
pip install -e .
Quick Start
1. Inventory Your GCP Resources
# Scan default project
gcp-radar inventory --export inventory.csv
# Scan specific project
gcp-radar inventory --project my-project --export inventory.csv
# Export to specific region
gcp-radar inventory --region us-central1 --export inventory.csv
2. Export Committed Use Discounts (CUDs)
# Every commitment on the billing account funding your current project
gcp-radar commitments --export commitments.csv
# Pick the billing account explicitly
gcp-radar commitments --billing-account 01ABCD-EF2345-6789GH --export commitments.csv
# Single project, or a single region
gcp-radar commitments --project my-project --export commitments.csv
gcp-radar commitments --region us-central1
# Or fold commitments into a regular inventory scan
gcp-radar inventory --commitments --export inventory.csv
Without --project, gcp-radar resolves the billing account, lists every project
attached to it, and scans each one — so you get all commitments on the account,
not just the current project's.
3. Export Daily Cost by Service
Reads the Cloud Billing BigQuery export
(gcp_billing_export_v1_*), prints the top services, and writes a CSV.
# Standalone: last 90 days, before credits
gcp-radar billing --table my-proj.billing.gcp_billing_export_v1_XXXXXX_XXXXXX_XXXXXX
# Net of credits, 30 days, one project
gcp-radar billing --table ... --days 30 --metric net --project my-project --output cost.csv
# Alongside an inventory scan or one-shot run
gcp-radar inventory --export inventory.csv --billing --billing-table ...
gcp-radar run --output inventory.csv --diagram architecture.drawio --billing-table ...
Set GCP_RADAR_BILLING_TABLE to skip --billing-table every time.
| Flag | Applies to | Default | Description |
|---|---|---|---|
--billing |
inventory, run |
off | Also export daily cost by service |
--billing-table / --table |
inventory, run / billing |
$GCP_RADAR_BILLING_TABLE |
Billing export table (required with --billing) |
--billing-days / --days |
inventory, run / billing |
90 | Trailing window in days |
--billing-metric / --metric |
inventory, run / billing |
gross |
gross = before credits, net = after credits |
--billing-output / --output |
inventory, run / billing |
billing.csv |
CSV output path |
--project |
billing |
all | Limit to one project ID |
--query-project |
billing |
ADC project | Project that runs the BigQuery job |
--include-zero |
billing |
off | Keep zero-cost service/day buckets |
With --billing on inventory/run, --project also limits the billing query.
4. One-Shot: Everything in One CSV
gcp-radar run --project my-project --billing-table my-proj.billing.gcp_billing_export_v1_XXXXXX \
--output inventory.csv --diagram architecture.drawio # --diagram is optional
Inventory, CUDs and billing land in a single file. Every row has a RecordType:
| RecordType | What it is | Columns it fills |
|---|---|---|
Inventory |
a scanned resource | Service, Name, ID, Type/Size, Status, Region, Extra |
Commitment |
a committed use discount (CUD) | same, plus Extra with plan, dates, auto-renew, vCPU/memory, etc. |
DailyCost |
cost per day, project and service | Date, Amount |
MonthlyCost |
cost per invoice month, project and service | InvoiceMonth, Gross, Net |
SkuCost |
cost per invoice month, project, service and SKU | InvoiceMonth, SKU, Gross, Net |
Credit |
CUD / SUD / promo credits per invoice month | Name, Type/Size, InvoiceMonth, Amount |
--output-csv / --output-diagram still work as aliases for --output / --diagram.
Without a billing table (--billing-table or GCP_RADAR_BILLING_TABLE) the billing rows are skipped.
5. Generate Architecture Diagram
gcp-radar diagram --input inventory.csv --output architecture.drawio
# Then open architecture.drawio in app.diagrams.net or the desktop app
Extending gcp-radar (plugins)
Other packages can add subcommands to gcp-radar via the gcp_radar.commands
entry-point group. In the plugin's pyproject.toml:
[project.entry-points."gcp_radar.commands"]
my-report = "my_pkg.commands:register"
# my_pkg/commands.py
def register(subparsers):
p = subparsers.add_parser("my-report", help="My extra report")
p.add_argument("--project", required=True)
p.set_defaults(func=run_my_report)
def run_my_report(args):
from gcp_radar.inventory import run_inventory
rows = run_inventory([args.project], export_path=None)
After pip install, gcp-radar my-report --project x works and shows up in gcp-radar --help.
A plugin that fails to load, or whose name clashes with an existing command, is skipped with a warning.
Supported GCP Services
| Service | Collected | Diagram |
|---|---|---|
| Compute Engine | ✓ | ✓ |
| Cloud SQL | ✓ | ✓ |
| Cloud Functions | ✓ | ✓ |
| GKE (Kubernetes Engine) | ✓ | ✓ |
| Cloud Storage | ✓ | ✓ |
| Cloud Run | ✓ | ✓ |
| Firestore | ✓ | ✓ |
| Pub/Sub | ✓ | ✓ |
| Committed Use Discounts | ✓ | – |
Requirements
- Python 3.9+
- GCP credentials (via
gcloud author service account key) - Permissions:
compute:Read,sql:Read,container:Read,storage:Read,pubsub:Read,firestore:Read, etc. - For
commitments:compute.commitments.liston each project, plusbilling.resourceAssociations.liston the billing account (to enumerate its projects) — e.g. roles/billing.viewer - For
billing/--billing: a billing export to BigQuery andbigquery.jobs.createplusbigquery.tables.getDataon the export table (e.g. roles/bigquery.jobUser + roles/bigquery.dataViewer)
Output Format
CSV Inventory
| ProjectID | Service | Name | ID | Type/Size | Status | Region | Extra |
|---|---|---|---|---|---|---|---|
| my-project | Compute Engine | web-01 | abc123 | n1-standard-2 | RUNNING | us-central1 | ... |
CSV Commitments
| BillingAccount | ProjectID | Name | ID | Region | Status | Plan | Type | Category | AutoRenew | StartTime | EndTime | vCPU | MemoryGB | LocalSSDGB | AcceleratorCount | AcceleratorType | Resources | Reservations | StatusMessage |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01ABCD-EF2345-6789GH | my-project | cud-1 | 42 | us-central1 | ACTIVE | TWELVE_MONTH | GENERAL_PURPOSE_N2D | MACHINE | True | 2026-01-01T00:00:00Z | 2027-01-01T00:00:00Z | 32 | 128.0 | 0 | 0 | - | VCPU:32, MEMORY:131072 | - | - |
CSV Billing
| BillingAccount | ProjectID | Date | Service | Amount | Currency |
|---|---|---|---|---|---|
| 01ABCD-EF2345-6789GH | my-project | 2026-09-24 | Compute Engine | 12.345678 | USD |
Architecture Diagram
Auto-generated .drawio file with:
- Swim lanes by service category (Compute, Database, Storage, Messaging)
- Icons for each resource
- Logical connections between services
Configuration
Create a .env file to override defaults:
export GCP_PROJECT=my-project
export GCP_REGION=us-central1
Or pass flags:
gcp-radar inventory --project my-project --region us-central1
License
MIT
Contributing
Pull requests welcome! Please open an issue first to discuss changes.
Support
GitHub Issues: https://github.com/yourname/gcp-radar/issues
Metadata
Release files for gcp-radar 1.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 | Provenance | Actions |
|---|---|---|---|---|
| gcp_radar-1.3.0.tar.gz | 30.4 kB | Without provenance | Details for gcp_radar-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gcp_radar-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for gcp_radar-1.3.0-py3-none-any.whl |
Total release size: 57.2 kB
Release files / gcp_radar-1.3.0.tar.gz
| Download URL | gcp_radar-1.3.0.tar.gz |
|---|---|
| Size | 30.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2964ea0c92dd3ec588dbd50428ab3e6cada4baf7d098bc377ec3cb21f1aa1723
|
|
BLAKE2b-256 checksum How to use checksums |
bd1e11557ed7c3aad6467552eccc19cf5eab24c825e2efc24d961c8e7a45a090
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / gcp_radar-1.3.0-py3-none-any.whl
| Download URL | gcp_radar-1.3.0-py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad2ad76e02aa09dd3640753dead85b9bd29fe3ec28e2d11e13027bb9095e72b9
|
|
BLAKE2b-256 checksum How to use checksums |
516d1cad7e9166ef0f9acbbaf946f7ea90064758fa27647c54036880c5820b63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for gcp-radar 1.3.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.