Selectively apply VM configuration updates in a MIG

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:

Alternatively, if you want to automate the rollout of a new configuration to all or to a random subset of the VMs in a MIG, see Automatically apply VM configuration updates in a MIG. To help you decide, see Methods to apply a new configuration to existing VMs.

Before you begin

Apply updated configuration to selected VMs

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.