Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A regional managed instance group can contain up to 2000 instances.

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 insert ...

Required Scalar Arguments

  • <project> (string)
    • Project ID for this request.
  • <region> (string)
    • Name of the region scoping this request.

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:
  all-instances-config:
    properties:
      labels: { string: string }
      metadata: { string: string }
  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-lifecycle-policy:
    default-action-on-failure: string
    force-update-on-repair: string
  instance-template: string
  kind: string
  list-managed-instances-results: string
  name: string
  region: string
  self-link: string
  status:
    all-instances-config:
      current-revision: string
      effective: boolean
    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 .all-instances-config.properties labels=key=et
    • The label key-value pairs that you want to patch onto the instance.
    • the value will be associated with the given key
  • metadata=key=voluptua.

    • The metadata key-value pairs that you want to patch onto the instance. For more information, see Project and instance metadata.
    • the value will be associated with the given key
  • ... base-instance-name=ea

    • 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=invidunt
    • [Output Only] The creation timestamp for this managed instance group in RFC3339 text format.
  • current-actions abandoning=23
    • [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=69
    • [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=39
    • [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=57
    • [Output Only] The number of instances in the managed instance group that are scheduled to be deleted or are currently being deleted.
  • none=11
    • [Output Only] The number of instances in the managed instance group that are running and have no scheduled actions.
  • recreating=45
    • [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=32
    • [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=58
    • [Output Only] The number of instances in the managed instance group that are scheduled to be restarted or are currently being restarted.
  • resuming=13
    • [Output Only] The number of instances in the managed instance group that are scheduled to be resumed or are currently being resumed.
  • starting=16
    • [Output Only] The number of instances in the managed instance group that are scheduled to be started or are currently being started.
  • stopping=9
    • [Output Only] The number of instances in the managed instance group that are scheduled to be stopped or are currently being stopped.
  • suspending=93
    • [Output Only] The number of instances in the managed instance group that are scheduled to be suspended or are currently being suspended.
  • verifying=34

    • [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=stet

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

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

    • 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=erat
    • [Output Only] A unique identifier for this resource type. The server generates this identifier.
  • instance-group=invidunt
    • [Output Only] The URL of the Instance Group resource.
  • instance-lifecycle-policy default-action-on-failure=dolor
    • The action that a MIG performs on a failed or an unhealthy VM. A VM is marked as unhealthy when the application running on that VM fails a health check. Valid values are - REPAIR (default): MIG automatically repairs a failed or an unhealthy VM by recreating it. For more information, see About repairing VMs in a MIG. - DO_NOTHING: MIG does not repair a failed or an unhealthy VM.
  • force-update-on-repair=ut

    • A bit indicating whether to forcefully apply the group's latest configuration when repairing a VM. Valid options are: - NO (default): If configuration updates are available, they are not forcefully applied during repair. Instead, configuration updates are applied according to the group's update policy. - YES: If configuration updates are available, they are applied during repair.
  • .. instance-template=dolores

    • 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=dolor
    • [Output Only] The resource type, which is always compute#instanceGroupManager for managed instance groups.
  • list-managed-instances-results=consetetur
    • Pagination behavior of the listManagedInstances API method for this managed instance group.
  • name=dolor
    • The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035.
  • region=sit
    • [Output Only] The URL of the region where the managed instance group resides (for regional resources).
  • self-link=no
    • [Output Only] The URL for this managed instance group. The server defines this URL.
  • status.all-instances-config current-revision=ut
    • [Output Only] Current all-instances configuration revision. This value is in RFC3339 text format.
  • effective=true

    • [Output Only] A bit indicating whether this configuration has been applied to all managed instances in the group.
  • .. autoscaler=dolor

    • [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 configuration 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=false

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

    • [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=sadipscing

    • 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=46
    • 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=elitr
    • 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=19
    • [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=25
    • Specifies a fixed number of VM instances. This must be a positive integer.
  • percent=48

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

    • [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=73
    • Specifies a fixed number of VM instances. This must be a positive integer.
  • percent=53

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

    • Minimal action to be taken on an instance. 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 REFRESH. 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=voluptua.
    • Most disruptive action that is allowed to be taken on an instance. You can specify either NONE to forbid any actions, REFRESH to avoid restarting the VM and to limit disruption as much as possible. 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=sed
    • What action should be used to replace instances. See minimal_action.REPLACE
  • type=consetetur

    • The type of update process. You can specify either PROACTIVE so that the MIG automatically updates VMs to the latest configurations or OPPORTUNISTIC so that you can select the VMs that you want to update.
  • .. zone=amet

    • [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.