John Adams
John Adams

Reputation: 11

Gcloud compute - How to get a list of all external IPs of instances?

Looking for a gcloud command that will return all external IPs of the instances currently active.

I understand gcloud compute addresses list returns a list of all instances but is there a way to filter out certain information to just return external IPS.

Thanks! :)

Upvotes: 0

Views: 2037

Answers (1)

Kristen Tracey
Kristen Tracey

Reputation: 152

If an address is internal, then the "addressType" field will specify INTERNAL. Otherwise, it defaults to EXTERNAL. So, to list external IPs, you can use this command:

$ gcloud compute addresses list --filter "NOT addressType:INTERNAL"

Reference: https://cloud.google.com/compute/docs/reference/rest/v1/addresses

Upvotes: 3

Related Questions