I am getting following error while trying to delete the vm via CLI.
ERROR: (gcloud.compute.instances.delete) Could not fetch resource:
- The resource ‘projects/peak-elevator-298712/zones/asia-east1-b/instances/myvm’ was not found
In the console; I can see the vm running; also from console
gcloud compute instances list — is showing the instance but not deleting it.
The sentence "The resource … was not found" said it all:
gcloud command could not find your instance in that specific zone and project.
You might want to check:
Which zone and project your instance is currently located at?
Which zone is set as the default for
gcloudon the computer where you execute it?
It could be the case that your instance was created in a different zone than the one set for
gcloud. You might want to specify the zone in your command, e.g.
gcloud compute instances delete <instance-name> --zone=ZONE-NAME.
Thanks @Tuan LE – this resolves the error.