Selectively apply VM configuration updates in a MIG
Stay organized with collections
Save and categorize content based on your preferences.
This document describes how to selectively apply configuration updates to the
virtual machine (VM) instances in a
managed instance group (MIG).
Compute Engine maintains the VMs in a MIG based on the
configuration components
that you use: instance template, optional all-instances configuration, and
optional stateful configuration.
Whenever you update a MIG's VM configuration by changing those components,
Compute Engine automatically applies your updated configuration to new
VMs that are added to the group.
To apply an updated configuration to existing VMs, you can set up a selective
update–also known as a "opportunistic" update type. This type of update offers
the following advantages:
You can select the VMs that you want to update.
You can control the timing and the sequence of the updates.
You can use the gcloud CLI or REST to update all
VMs immediately.
If you haven't already, set up authentication.
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:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI.
After installation,
initialize the Google Cloud CLI by running the following command:
Ensure your group's update policy type is set to "opportunistic" to prevent
the MIG from automatically applying new a VM configuration to existing VMs. For
more information, see
Check your group's update policy type.
Then use the gcloud CLI or REST to update your MIG's
configuration and to apply the latest configuration to specific VMs in the
group or to all VMs in the group.
Permissions required for this task
To perform this task, you must have the following
permissions:
After you make a request, you can
check the status
to verify that the update is complete.
Control the disruption level during selective updates
Depending on the nature of an update, it might disrupt an instance's
state. For example, changing an
instance's boot disk requires replacing the instance. You can
control the level of disruption during a selective update by setting the
following options:
Minimal action: Use this option to minimize disruption as much as possible
or to apply a more disruptive action than is necessary.
To limit disruption as much as possible, set the minimal action to
NONE. If your update requires a more disruptive action,
Compute Engine performs the necessary action to execute the
update.
To apply a more disruptive action than is strictly necessary, set the
minimal action to RESTART or REPLACE. For example,
Compute Engine does not need to restart a VM to change its
metadata. But if your application reads instance metadata only when a VM
is restarted, you can set the minimal action to RESTART in order to pick
up metadata changes.
Most disruptive allowed action: Use this option to prevent an update if
it requires more disruption than you can afford. If your update requires a
more disruptive action than you set with this flag, the update request fails.
For example, if you set the most disruptive allowed action to RESTART, then
an attempt to update the boot disk image fails because that update requires
instance recreation, a more disruptive action than a restart.
When updating selected VMs, both of these options accept the following
values:
Additional disks, Dynamic NICs, instance metadata,
labels, tags, machine type
REPLACE
Delete the instance and create it again.
All instance properties stored in the instance template or per-instance
configuration
The most disruptive allowed action can't be less disruptive than the minimal
action.
When you selectively update VMs, the following defaults apply:
The default minimal action is NONE, which limits disruption as much as
possible.
The default most disruptive allowed action is REPLACE. If you cannot
tolerate such disruption, set the most disruptive allowed action to be less
disruptive.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-07-17 UTC."],[],[]]