Skip to main content

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 .drawio files 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-csv inventory.csv --output-diagram architecture.drawio \
  --billing --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. Generate Architecture Diagram

gcp-radar diagram --input inventory.csv --output architecture.drawio

# Then open architecture.drawio in app.diagrams.net or the desktop app

5. One-Shot: Scan + Diagram

gcp-radar run --project my-project \
  --output-csv inventory.csv \
  --output-diagram architecture.drawio

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 auth or service account key)
  • Permissions: compute:Read, sql:Read, container:Read, storage:Read, pubsub:Read, firestore:Read, etc.
  • For commitments: compute.commitments.list on each project, plus billing.resourceAssociations.list on the billing account (to enumerate its projects) — e.g. roles/billing.viewer
  • For billing / --billing: a billing export to BigQuery and bigquery.jobs.create plus bigquery.tables.getData on 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

Release files for gcp-radar 1.1.1

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

Source distribution (sdist)

Source distribution for gcp-radar 1.1.1
File Size Uploaded
gcp_radar-1.1.1.tar.gz 26.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gcp-radar 1.1.1
File Interpreter ABI Platform
gcp_radar-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 49.0 kB

Release files / gcp_radar-1.1.1.tar.gz

Download URL gcp_radar-1.1.1.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c72085b4f6008199b5eec99f21b9cfc5d45cbc92e9c17303aeda06a591cbd534
BLAKE2b-256 checksum
How to use checksums
02c38ecdfe20c09dcfbd7f8306542d6645b4238d8ae9684898ac779caf8c7344
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.1.1-py3-none-any.whl

Download URL gcp_radar-1.1.1-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54b0953e37113b2ceddbea436f5ddbb562aa9ebbebbe473a7950a6044c1e1701
BLAKE2b-256 checksum
How to use checksums
cda529fb099d131b01846a61f1c96d83fb6d8b6b5709c635e052eaad570a6eef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

1.3.0

2 release files

1.2.0

2 release files

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

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