I need help in google cloud , I am doing 1 application using google cloud. in google cloud I have 1 instance of windows and google cloud sdk on that. I need one command which will return zone name of that instance.
I don't need zone list.
I need only that zone name where my instance is running.
thank you in advance.
gcloud compute instances list <your instance name> --format 'csv[no-heading](zone)'
. . .
This is doing two things. The
gcloud compute instances list your-instance-name
part lists all instances with that name, e.g.
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS your-instance-name europe-west1-c n1-standard-1 1.000.000.001 100.000.000.01 RUNNING
part reformats the output to be a table with with headers and only the
zone column. See https://cloud.google.com/sdk/gcloud/reference/topic/formats (or
gcloud help topic formats) for more information about formatting output.