2 Answers
Hmmm… That’s interesting, Divya. I believe the default zone it offers will reflect your physical location as best as Google can determine from just your connection–but if the "compute/zone" property was still set, I wouldn’t expect it to prompt you, at all. Before you ran gcloud compute ssh myhappyvm
, did you possibly restart your Cloud Shell instance, run gcloud init
, or somehow clear that "compute/zone" property?
Mattias
So in my case when I try to delete "myhappyvm" it prompts "Did you mean zone [asia-southeast1-b] for instance: [myhappyvm]" but thats not where my VM is….. not very sure why it even gives me such a message when it knows that my VM sits in "us-west2-b"
Upon reading very carefully when it prompts the wrong zone and when you say NO, then it wakes up and may be it tries to guess "No zone specified. Using zone [us-west2-b] for instance: [myhappyvm]." and then upon selecting "Y" it deletes my VM
Note: One of my VM "myvmclear" sits in zone asia-southeast1-b
———————–output from Command Line——————————————
[email protected]:~/.ssh (gcp-lab-226009)$ gcloud compute instances delete myhappyvm
Did you mean zone [asia-southeast1-b] for instance: [myhappyvm] (Y/n)?
Y
The following instances will be deleted. Any attached disks configured
to be auto-deleted will be deleted unless they are attached to any
other instances or the --keep-disks
flag is given and specifies them
for keeping. Deleting a disk is irreversible and any data on the disk
will be lost.
- [myhappyvm] in [asia-southeast1-b]
Do you want to continue (Y/n)? n
ERROR: (gcloud.compute.instances.delete) Deletion aborted by user.
[email protected]:~/.ssh (gcp-lab-226009)$ gcloud compute instances delete myhappyvm
Did you mean zone [asia-southeast1-b] for instance: [myhappyvm] (Y/n)?
n
No zone specified. Using zone [us-west2-b] for instance: [myhappyvm].
The following instances will be deleted. Any attached disks configured
to be auto-deleted will be deleted unless they are attached to any
other instances or the --keep-disks
flag is given and specifies them
for keeping. Deleting a disk is irreversible and any data on the disk
will be lost.
- [myhappyvm] in [us-west2-b]
Do you want to continue (Y/n)? Y
Deleted [https://www.googleapis.com/compute/v1/projects/gcp-lab-226009/zones/us-west2-b/instances/myhappyvm].