List firewall policies at folder / organization level :
gcloud compute firewall-policies list --organization=$ORGANIZATION_ID
Result output can be used to analyze each policy :
#example using the default root-firewall-policygcloud compute firewall-policies describe --organization=$ORGANIZATION_ID root-firewall-policy --format=json
List unitary VPC firewall rules (specify project ID if not the default one). Same principle applies to describe keyword.
gcloud compute firewall-rules list
List global VPC’s firewall policies :
gcloud compute network-firewall-policies list --global
List regional VPC’s firewall policies :
#This is the exhaustive list of every policies possibly deployed. Longer output result, but you may miss existing configuration otherwise.gcloud compute network-firewall-policies list \--regions=asia-east1,asia-east2,asia-northeast1,asia-northeast2,\asia-northeast3,asia-south1,asia-south2,asia-southeast1,\asia-southeast2,australia-southeast1,australia-southeast2,\europe-central2,europe-north1,europe-west1,europe-west2,\europe-west3,europe-west4,europe-west6,northamerica-northeast1,\northamerica-northeast2,southamerica-east1,southamerica-west1,\us-central1,us-east1,us-east4,us-west1,us-west2,us-west3,us-west4
List internal IP in a project :
gcloud compute instances list \--format="value(networkInterfaces[0].networkIP)"
List external IP in a project :
gcloud compute instances list \--format="value(networkInterfaces[0].accessConfigs[0].natIP)"
List every instances with starting or shut down scripts :
gcloud compute instances list \--filter="metadata.items.key=('startup-script','shutdown-script')" \--format="table(name,zone,metadata.items)"
These requires Cloud Asset Inventory
This service is completely free unless you store the output data in buckets from it. However the benefits from the queries are absolutely insane.
Given the highest node scope, return every role/principal associations :