Manually live migrate VMs Stay organized with collections Save and categorize content based on your preferences.
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
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
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.updatepermissions 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 destination Key to specify Node group compute.googleapis.com/node-group-nameNode compute.googleapis.com/node-nameNODE_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.