Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
GCP Load Balancer Inventory (org-wide)
-------------------------------------
Finds all load balancers across an ORGANIZATION using Cloud Asset Inventory (CAI)
and, when needed, the Compute Engine API. It outputs a JSON file with, for each
load balancer (derived from Forwarding Rules), the frontend (ingress) IPs and
best-effort backend (egress) IPs (e.g., instance/NEG endpoint IPs).