gcloud compute instance-groups managed update-instances Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud compute instance-groups managed update-instances - immediately update selected instances in a Compute Engine managed instance group
- SYNOPSIS
gcloud compute instance-groups managed update-instancesNAME(--all-instances|--instances=INSTANCE,[INSTANCE,…])[--minimal-action=MINIMAL_ACTION; default="none"][--most-disruptive-allowed-action=MOST_DISRUPTIVE_ALLOWED_ACTION; default="replace"][--region=REGION|--zone=ZONE][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
- When using a managed instance group, it's possible that your intendedspecification for a VM is different from the current state of that VM. Forexample, this can happen due to changes to the group's target instance template.This command enables you to initiate the update process on the given set ofinstances instantly, thus when your Managed Instance Group is stable you can besure that all the changes were applied.
gcloud compute instance-groups managed update-instancesallows youto specify the least and the most disruptive actions that can be performed whileupdating the instances. This way you can reduce the risk of rolling out too manychanges at once. Possible actions are:none,refresh,restartandreplace. The level of disruption to theinstance is ordered as:none<refresh<restart<replace.The command returns the operation status per instance, which might be
,FAIL, orSUCCESS.MEMBER_NOT_FOUNDis returned only forregional groups when the gcloud command-line tool wasn't able to resolve thezone from the instance name.MEMBER_NOT_FOUND - EXAMPLES
- To update instances
instance-1,instance-2inmy-group, withminimal-action=noneandmost-disruptive-allowed-action=restart, run:gcloudcomputeinstance-groupsmanagedupdate-instancesmy-group--instances=instance-1,instance2--minimal-action=none--most-disruptive-allowed-action=restart - POSITIONAL ARGUMENTS
NAME- Name of the managed instance group to operate on.
- REQUIRED FLAGS
- Exactly one of these must be specified:
--all-instances- Update all instances in the group.
--instances=INSTANCE,[INSTANCE,…]- Names of instances to update.
- Exactly one of these must be specified:
- OPTIONAL FLAGS
--minimal-action=MINIMAL_ACTION; default="none"- Use this flag to minimize disruption as much as possible or to apply a moredisruptive action than is strictly necessary. The MIG performs at least thisaction on each instance while updating. If the update requires a more disruptiveaction than the one specified here, then the more disruptive action isperformed. If you omit this flag, the update uses the
value from the MIG's updatepolicy, unless it is not set in which case the default isminimal-action.replaceMINIMAL_ACTIONmust be one of:none- No action
refresh- Apply the new configuration without stopping VMs, if possible. For example, use``refresh`` to apply changes that only affect metadata or additional disks.
restart- Apply the new configuration without replacing VMs, if possible. For example,stopping VMs and starting them again is sufficient to apply changes to machinetype.
replace- Replace old VMs according to the --replacement-method flag.
--most-disruptive-allowed-action=MOST_DISRUPTIVE_ALLOWED_ACTION; default="replace"- Use this flag to prevent an update if it requires more disruption than you canafford. At most, the MIG performs the specified action on each instance whileupdating. If the update requires a more disruptive action than the one specifiedhere, then the update fails and no changes are made. If you omit this flag, theupdate uses the
value fromthe MIG's update policy, unless it is not set in which case the default ismost-disruptive-allowed-action.replaceMOST_DISRUPTIVE_ALLOWED_ACTIONmust be one of:none- No action
refresh- Apply the new configuration without stopping VMs, if possible. For example, use``refresh`` to apply changes that only affect metadata or additional disks.
restart- Apply the new configuration without replacing VMs, if possible. For example,stopping VMs and starting them again is sufficient to apply changes to machinetype.
replace- Replace old VMs according to the --replacement-method flag.
- At most one of these can be specified:
--region=REGION- Region of the managed instance group to operate on. If not specified, you mightbe prompted to select a region (interactive mode only).
A list of regions can be fetched by running:
gcloudcomputeregionslistOverrides the default
compute/regionproperty value for thiscommand invocation. --zone=ZONE- Zone of the managed instance group to operate on. If not specified, you might beprompted to select a zone (interactive mode only).
A list of zones can be fetched by running:
gcloudcomputezoneslistOverrides the default
compute/zoneproperty value for this commandinvocation.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - NOTES
- These variants are also available:
gcloudalphacomputeinstance-groupsmanagedupdate-instancesgcloudbetacomputeinstance-groupsmanagedupdate-instances
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 2025-05-07 UTC.