Manually live migrate VMs

Linux Windows

To move sole-tenant VMs to a different node or node group, you can manuallyinitiate a live migration. You can also manually initiate a live migration tomove a multi-tenant VM into sole-tenancy. For information about how to move a VMout of sole-tenancy, seeMove a VM out of sole-tenancy.

Before you begin

API rate limits

Manual live migration requests are categorized in theQueriesAPI ratelimit.

Manually live migrate VMs into or within sole-tenancy

To manually live migrate VMs into or within sole-tenancy, use thegcloud CLI or REST.

If the destination of the VM is a node group, Compute Engine selectsthe node within the group that has both enough space for the VM and the leastamount of spare capacity.

You cannot perform live migration between projects while using sharedsole-tenant node groups.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • compute.instances.update permissions on the VM.

gcloud

To manually live migrate VMs into or within sole-tenancy, use the followinggcloud compute instances update command:

gcloud compute instances updateVM_NAME \    ( --node=NODE \      --node-group=NODE_GROUP \      --node-affinity-file=NODE_AFFINITY_FILE )

Replace the following:

  • VM_NAME: the name of the VM to update the nodeaffinity labels for.

Replace exactly one of the following:

  • NODE: the name of the node to live migrate the VMto.

  • NODE_GROUP: the name of the node group to livemigrate the VM to.

  • NODE_AFFINITY_FILE: the name of a JSON filecontaining a configuration of nodes on which this VM could be scheduled.For more information, seeConfigure node affinitylabels.

REST

To manually live migrate VMs into or within sole-tenancy, use the followinginstances.update method:

PUT https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME{  ...  "scheduling": {    "nodeAffinities": [      {        "key": "NODE_AFFINITY_LABEL_KEY",        "operator": "IN",        "values": [          "[NODE_AFFINITY_LABEL_VALUE]"        ]      }    ]  }  ...}

Replace the following:

  • PROJECT_ID: the ID of the project that has the VMto update the node affinity labels for.

  • ZONE: the zone of the VM to update the nodeaffinity labels for.

  • VM_NAME: the name of the VM to update the nodeaffinity labels for.

  • NODE_AFFINITY_LABEL_KEY: one of the followingstrings that specifies whether to live migrate the VM to a node group ornode:

    VM destinationKey to specify
    Node groupcompute.googleapis.com/node-group-name
    Nodecompute.googleapis.com/node-name
  • NODE_AFFINITY_LABEL_VALUE: the name of the nodegroup or node to live migrate the VM to.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.