Ebin Davis
Ebin Davis

Reputation: 6139

How to list the machine types within a specific zone using gcp cli?

I list the set of machine types in GCP using:

gcloud compute machine-types list

Also I list the machine types and its zone using:

gcloud compute machine-types list --format=value"(NAME,ZONE)"

Both commands give the right output with no errors.

But I want to list the set of machine types in a specific zone. I tried the following:

gcloud compute machine-types list --format="value(NAME,ZONE=asia-southeast1-a)"

which outputs this error:

ERROR: (gcloud.compute.machine-types.list) Expected ) in projection expression [ table( name, zone.basename(), guestCpus:label=CPUS, memoryMb.size(units_in=MiB, units_out=GiB, precision=2):label=MEMORY_GB, deprecated.state:label=DEPRECATED ) value(NAME,ZONE HERE =asia-southeast1-a)].

I want to list the machine types only in asia-southeast1-a using a gcloud command.

Upvotes: 1

Views: 972

Answers (1)

Phonolog
Phonolog

Reputation: 6511

You can use a topic filter with the --filter option:

gcloud compute machine-types list --filter="zone: asia-southeast1-a" --format=value"(NAME,ZONE)"

Upvotes: 4

Related Questions