Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

Error while delete vm via cli on GCP

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.

1 Answers

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 gcloud on 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.

Zeeshan Zia

Thanks @Tuan LE – this resolves the error.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?