ecl0
ecl0

Reputation: 435

How to query load balancers with google cloud shell?

Is it possible to query the load balancers using the cloud shell? I need to find all the IPs hitting it.

Upvotes: 1

Views: 981

Answers (2)

imesh
imesh

Reputation: 1644

In GCP Load Balancers, the listeners are exposed using Forwarding Rules. Hence, you could use the following command for listing those via the gcloud CLI:

gcloud compute forwarding-rules list

Reference: https://cloud.google.com/sdk/gcloud/reference/compute/forwarding-rules/list

Upvotes: 1

PrecariousJimi
PrecariousJimi

Reputation: 1533

You can peek into requests hitting your configured HTTP Load Balancers in Cloud Console Logs Viewer by selecting Cloud HTTP Load Balancer resource type.

For detailed view you can export request logs into BigQuery dataset and perform powerful aggregations using SQL.

Note: information above applies to Google Cloud HTTP Load Balancer only. Network Load Balancer, on the other hand, just forwards packets to your VMs, so you will need to analyze traffic directly on your backends.

Upvotes: 0

Related Questions