Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it's possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG.

Scopes

You will need authorization for at least one of the following scopes to make a valid call:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/compute

If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform. You can set the scope for this method like this: compute1 --scope <scope> region-instance-group-managers patch ...

Required Scalar Arguments

  • <project> (string)
    • Project ID for this request.
  • <region> (string)
    • Name of the region scoping this request.
  • <instance-group-manager> (string)
    • The name of the instance group manager.

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

InstanceGroupManager:
  base-instance-name: string
  creation-timestamp: string
  current-actions:
    abandoning: integer
    creating: integer
    creating-without-retries: integer
    deleting: integer
    none: integer
    recreating: integer
    refreshing: integer
    restarting: integer
    resuming: integer
    starting: integer
    stopping: integer
    suspending: integer
    verifying: integer
  description: string
  distribution-policy:
    target-shape: string
  fingerprint: string
  id: string
  instance-group: string
  instance-template: string
  kind: string
  name: string
  region: string
  self-link: string
  status:
    autoscaler: string
    is-stable: boolean
    stateful:
      has-stateful-config: boolean
      per-instance-configs:
        all-effective: boolean
    version-target:
      is-reached: boolean
  target-pools: [string]
  target-size: integer
  update-policy:
    instance-redistribution-type: string
    max-surge:
      calculated: integer
      fixed: integer
      percent: integer
    max-unavailable:
      calculated: integer
      fixed: integer
      percent: integer
    minimal-action: string
    most-disruptive-allowed-action: string
    replacement-method: string
    type: string
  zone: string

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r . base-instance-name=magna
    • The base instance name to use for instances in this group. The value must be 1-58 characters long. Instances are named by appending a hyphen and a random four-character string to the base instance name. The base instance name must comply with RFC1035.
  • creation-timestamp=kasd
    • [Output Only] The creation timestamp for this managed instance group in RFC3339 text format.
  • current-actions abandoning=62
    • [Output Only] The total number of instances in the managed instance group that are scheduled to be abandoned. Abandoning an instance removes it from the managed instance group without deleting it.
  • creating=95
    • [Output Only] The number of instances in the managed instance group that are scheduled to be created or are currently being created. If the group fails to create any of these instances, it tries again until it creates the instance successfully. If you have disabled creation retries, this field will not be populated; instead, the creatingWithoutRetries field will be populated.
  • creating-without-retries=53
    • [Output Only] The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create any of these instances, it decreases the group's targetSize value accordingly.
  • deleting=97
    • [Output Only] The number of instances in the managed instance group that are scheduled to be deleted or are currently being deleted.
  • none=5
    • [Output Only] The number of instances in the managed instance group that are running and have no scheduled actions.
  • recreating=70
    • [Output Only] The number of instances in the managed instance group that are scheduled to be recreated or are currently being being recreated. Recreating an instance deletes the existing root persistent disk and creates a new disk from the image that is defined in the instance template.
  • refreshing=36
    • [Output Only] The number of instances in the managed instance group that are being reconfigured with properties that do not require a restart or a recreate action. For example, setting or removing target pools for the instance.
  • restarting=26
    • [Output Only] The number of instances in the managed instance group that are scheduled to be restarted or are currently being restarted.
  • resuming=9
    • [Output Only] The number of instances in the managed instance group that are scheduled to be resumed or are currently being resumed.
  • starting=77
    • [Output Only] The number of instances in the managed instance group that are scheduled to be started or are currently being started.
  • stopping=3
    • [Output Only] The number of instances in the managed instance group that are scheduled to be stopped or are currently being stopped.
  • suspending=8
    • [Output Only] The number of instances in the managed instance group that are scheduled to be suspended or are currently being suspended.
  • verifying=49

    • [Output Only] The number of instances in the managed instance group that are being verified. See the managedInstances[].currentAction property in the listManagedInstances method documentation.
  • .. description=sed

    • An optional description of this resource.
  • distribution-policy target-shape=sit

    • The distribution shape to which the group converges either proactively or on resize events (depending on the value set in updatePolicy.instanceRedistributionType).
  • .. fingerprint=clita

    • Fingerprint of this resource. This field may be used in optimistic locking. It will be ignored when inserting an InstanceGroupManager. An up-to-date fingerprint must be provided in order to update the InstanceGroupManager, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an InstanceGroupManager.
  • id=stet
    • [Output Only] A unique identifier for this resource type. The server generates this identifier.
  • instance-group=aliquyam
    • [Output Only] The URL of the Instance Group resource.
  • instance-template=stet
    • The URL of the instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE.
  • kind=est
    • [Output Only] The resource type, which is always compute#instanceGroupManager for managed instance groups.
  • name=est
    • The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035.
  • region=est
    • [Output Only] The URL of the region where the managed instance group resides (for regional resources).
  • self-link=takimata
    • [Output Only] The URL for this managed instance group. The server defines this URL.
  • status autoscaler=stet
    • [Output Only] The URL of the Autoscaler that targets this instance group manager.
  • is-stable=true
    • [Output Only] A bit indicating whether the managed instance group is in a stable state. A stable state means that: none of the instances in the managed instance group is currently undergoing any type of change (for example, creation, restart, or deletion); no future changes are scheduled for instances in the managed instance group; and the managed instance group itself is not being modified.
  • stateful has-stateful-config=true
    • [Output Only] A bit indicating whether the managed instance group has stateful configuration, that is, if you have configured any items in a stateful policy or in per-instance configs. The group might report that it has no stateful config even when there is still some preserved state on a managed instance, for example, if you have deleted all PICs but not yet applied those deletions.
  • per-instance-configs all-effective=true

    • A bit indicating if all of the group's per-instance configs (listed in the output of a listPerInstanceConfigs API call) have status EFFECTIVE or there are no per-instance-configs.
  • ...version-target is-reached=false

    • [Output Only] A bit indicating whether version target has been reached in this managed instance group, i.e. all instances are in their target version. Instances' target version are specified by version field on Instance Group Manager.
  • ... target-pools=duo

    • The URLs for all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group.
    • Each invocation of this argument appends the given value to the array.
  • target-size=42
    • The target number of running instances for this managed instance group. You can reduce this number by using the instanceGroupManager deleteInstances or abandonInstances methods. Resizing the group also changes this number.
  • update-policy instance-redistribution-type=vero
    • The instance redistribution policy for regional managed instance groups. Valid values are: - PROACTIVE (default): The group attempts to maintain an even distribution of VM instances across zones in the region. - NONE: For non-autoscaled groups, proactive redistribution is disabled.
  • max-surge calculated=65
    • [Output Only] Absolute value of VM instances calculated based on the specific mode. - If the value is fixed, then the calculated value is equal to the fixed value. - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded.
  • fixed=3
    • Specifies a fixed number of VM instances. This must be a positive integer.
  • percent=61

    • Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.
  • ..max-unavailable calculated=93

    • [Output Only] Absolute value of VM instances calculated based on the specific mode. - If the value is fixed, then the calculated value is equal to the fixed value. - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded.
  • fixed=55
    • Specifies a fixed number of VM instances. This must be a positive integer.
  • percent=18

    • Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.
  • .. minimal-action=sit

    • Minimal action to be taken on an instance. You can specify either RESTART to restart existing instances or REPLACE to delete and create new instances from the target template. If you specify a RESTART, the Updater will attempt to perform that action only. However, if the Updater determines that the minimal action you specify is not enough to perform the update, it might perform a more disruptive action.
  • most-disruptive-allowed-action=vero
    • Most disruptive action that is allowed to be taken on an instance. You can specify either NONE to forbid any actions, REFRESH to allow actions that do not need instance restart, RESTART to allow actions that can be applied without instance replacing or REPLACE to allow all possible actions. If the Updater determines that the minimal update action needed is more disruptive than most disruptive allowed action you specify it will not perform the update at all.
  • replacement-method=duo
    • What action should be used to replace instances. See minimal_action.REPLACE
  • type=et

    • The type of update process. You can specify either PROACTIVE so that the instance group manager proactively executes actions in order to bring instances to their target versions or OPPORTUNISTIC so that no action is proactively executed but the update will be performed as part of other actions (for example, resizes or recreateInstances calls).
  • .. zone=est

    • [Output Only] The URL of a zone where the managed instance group is located (for zonal resources).

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional Method Properties

You may set the following properties to further configure the call. Please note that -p is followed by one or more key-value-pairs, and is called like this -p k1=v1 k2=v2 even though the listing below repeats the -p for completeness.

  • -p request-id=string
    • An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").
  • -p user-ip=string

    • Legacy name for parameter that has been superseded by quotaUser.