3

Trying to list all external ips for all load balancers per project in gcp.I know how to list all external ips using the below command but I am trying to filter it somehow and keep only LB's gcloud compute addresses list --filter "NOT addressType:INTERNAL"

New on this this so apologies in advance if my question is not submitted proberly. Any ideas will be helpful.

Thanks

Tina
  • 31
  • 1
  • 2
  • 2
    I think you want to check `gcloud compute forwarding-rules list`. These should exist for each load-balancer in a project and include the IP address. See: https://cloud.google.com/sdk/gcloud/reference/compute/forwarding-rules/list and https://cloud.google.com/compute/docs/reference/rest/v1/forwardingRules/list. I don't have any load-balancers to test this against, so please corroborate that this is indeed a definitive list for you. – DazWilkin Mar 26 '21 at 17:04

1 Answers1

6

Each forwarding rule references an IP address and one or more ports on which the load balancer accepts traffic. The forwarding rule also specifies an IP protocol. For Google Cloud load balancers, the IP protocol is always either TCP or UDP.

Depending on the load balancer type, the following is true:

  1. A forwarding rule specifies a backend service, target proxy, or target pool.
  2. A forwarding rule and its IP address are internal or external.

By using below command you can get the Load balancer front-end configured IP addresses

$ gcloud compute forwarding-rules list
Priya Gaikwad
  • 455
  • 3
  • 8