Search code examples
google-cloud-platformgoogle-compute-engineuefi

Move Google Cloud Compute instance between zones


I have a Compute Engine instance on Google Cloud on zone europe-west3-c. In last several days, when I try to start it I get following message:

The zone 'projects/PROJECT/zones/europe-west3-c' does not have enough resources available to fulfill the request. Try a different zone, or try again later.

Since I've been trying to connect for several days, I decided to move the instance between zones. I tried with this API: https://cloud.google.com/compute/docs/reference/rest/v1/projects/moveInstance

But I get this error:

404: Invalid resource usage: 'Instance is a UEFI-enabled instance and does not support MoveInstance.'.

I really need this computing instance for my work so any quick help would be very much appriciated!


Solution

  • Using the following gcloud command you can move an instance automatically. However, When possible, use the moveInstances API to save yourself some work, but there are some scenarios where using the moveInstances API is not an option.

    gcloud compute instances move example-instance-1 --zone us-central1-b --destination-zone us-central1-f
    

    Whenever possible, move an instance automatically using the moveInstance API, which handles all the steps for moving an instance for you. However, if you cannot use the API, you can perform the move manually.

    You can create image or snapshot from the instance disk then you can create new instance from the image or also you can create instance from snapshot. You can create a new VM in any region/zone.

    Another way you can detaching the VM disk using the following gcloud command:

    gcloud compute instances detach-disk Instance-Name --disk=Disk-Name --zone Disk-zone
    

    Now if you go to Compute Engine > Disks > Click the name of VM disk > Manage disk > CREATE INSTANCE; creating new instance you can change or move the VM instance to your chosen region/zone.