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
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
Release files for gcp-radar 1.2.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 | |
|---|---|---|---|
| gcp_radar-1.2.0.tar.gz | 29.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gcp_radar-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.4 kB
Release files / gcp_radar-1.2.0.tar.gz
| Download URL | gcp_radar-1.2.0.tar.gz |
|---|---|
| Size | 29.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbf7a62cfc08c8169ac2d8cf764bb54162142d347e4b994dbf30d403da563378
|
|
BLAKE2b-256 checksum How to use checksums |
ed078dc56155132d081df22a4dd11fd6feb7dcdf224fee1804c3273d6ac7bda3
|
| 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.2.0-py3-none-any.whl
| Download URL | gcp_radar-1.2.0-py3-none-any.whl |
|---|---|
| Size | 26.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5887bf68ea4b0ee4d5e179f629e3202ae01f1d7b55eac10a301cdb8b912854f
|
|
BLAKE2b-256 checksum How to use checksums |
144993e9efcb39a1d01a4aa42bffe5c03eb7ffdaebbb66693f2c77b01e2bace9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|