gcloud compute instance-groups managed create-instance

NAME
gcloud compute instance-groups managed create-instance - create a new virtual machine instance in a managed instance group with a defined name and optionally its stateful configuration
SYNOPSIS
gcloud compute instance-groups managed create-instanceNAME--instance=INSTANCE[--stateful-disk=[auto-delete=AUTO-DELETE],[device-name=DEVICE-NAME],[mode=MODE],[source=SOURCE]][--stateful-external-ip=[address=ADDRESS],[auto-delete=AUTO-DELETE],[interface-name=INTERFACE-NAME]][--stateful-internal-ip=[address=ADDRESS],[auto-delete=AUTO-DELETE],[interface-name=INTERFACE-NAME]][--stateful-metadata=KEY=VALUE,[KEY=VALUE,…]][--region=REGION    |--zone=ZONE][GCLOUD_WIDE_FLAG]
DESCRIPTION
gcloud compute instance-groups managed create-instance creates avirtual machine instance with a defined name and optionally its statefulconfiguration: stateful disk, stateful metadata key-values, and stateful IPaddresses. Stateful configuration is stored in the corresponding newly createdper-instance config. An instance with a per-instance config will preserve itsgiven name, specified disks, specified metadata key-values, and specifiedinternal and external IPs during instance recreation, auto-healing, updates, andany other lifecycle transitions of the instance.
EXAMPLES
To create an instanceinstance-1 inmy-group (inregion europe-west4) with metadatamy-key: my-value, a diskdisk-1 attached to it as the devicedevice-1, statefulinternal IP192.168.0.10 on the default interface (nic0), andexisting address reservationmy-address for stateful external IP oninterfacenic1, run:
gcloudcomputeinstance-groupsmanagedcreate-instancemy-group--region=europe-west4--instance=instance-1--stateful-disk='device-name=foo,source=https://compute.googleapis.com/compute/alpha/projects/my-project/zones/europe-west4/disks/disk-1,mode=rw,auto-delete=on-permanent-instance-deletion'--stateful-metadata='my-key=my-value'--stateful-internal-ip=address=192.168.0.10,auto-delete=on-permanent-instance-deletion--stateful-external-ip=address=/projects/example-project/regions/europe-west4/addresses/my-address,interface-name=nic1
POSITIONAL ARGUMENTS
NAME
Name of the managed instance group to create instance in.
REQUIRED FLAGS
--instance=INSTANCE
Name of the new instance to create.
OPTIONAL FLAGS
--stateful-disk=[auto-delete=AUTO-DELETE],[device-name=DEVICE-NAME],[mode=MODE],[source=SOURCE]
Disks considered stateful by the instance group. Managed instance groupspreserve and reattach stateful disks on VM autohealing, update, and recreateevents.

You can also attach and preserve disks, not defined in the group's instancetemplate, to a given instance.

The same disk can be attached to more than one instance but only in read-onlymode.

--stateful-external-ip=[address=ADDRESS],[auto-delete=AUTO-DELETE],[interface-name=INTERFACE-NAME]
Managed instance groups preserve stateful IPs on VM autohealing, update, andrecreate events.

Use this argument multiple times to update more IPs.

If a stateful external IP with the given interface name already exists in thecurrent instance configuration, its properties are replaced by the newlyprovided ones. Otherwise, a new stateful external IP definition is added to theinstance configuration.

interface-name
(Optional) Network interface name. If omitted, the default network interfacenamednic0 is assumed.
*address*:::StaticIPaddresstoassigntotheinstanceinoneofthefollowingformats:

+ Address: URL of a static IP address reservation. For example:projects/example-project/regions/us-east1/addresses/example-ip-name.

+ Literal: For example:130.211.181.55.

If the provided IP address is not yet reserved, the managed instance groupautomatically creates the corresponding IP address reservation. If the providedIP address is reserved, the group assigns the reservation to the instance.

auto-delete
(Optional) Prescribes what should happen to an associated static Addressresource when a VM instance is permanently deleted. Regardless of the value ofthe delete rule, stateful IP addresses are always preserved on instanceautohealing, update, and recreation operations. The following options areavailable:
  • never: (Default) Never delete the static IPaddress. Instead, unassign the address when its instance is permanently deletedand keep the address reserved.
  • on-permanent-instance-deletion: Delete thestatic IP address reservation when the instance that it's assigned to ispermanently deleted from the instance group; for example, when the instance isdeleted manually or when the group size is decreased.
--stateful-internal-ip=[address=ADDRESS],[auto-delete=AUTO-DELETE],[interface-name=INTERFACE-NAME]
Managed instance groups preserve stateful IPs on VM autohealing, update, andrecreate events.

Use this argument multiple times to update more IPs.

If a stateful internal IP with the given interface name already exists in thecurrent instance configuration, its properties are replaced by the newlyprovided ones. Otherwise, a new stateful internal IP definition is added to theinstance configuration.

interface-name
(Optional) Network interface name. If omitted, the default network interfacenamednic0 is assumed.
*address*:::StaticIPaddresstoassigntotheinstanceinoneofthefollowingformats:

+ Address: URL of a static IP address reservation. For example:projects/example-project/regions/us-east1/addresses/example-ip-name.

+ Literal: For example:130.211.181.55.

If the provided IP address is not yet reserved, the managed instance groupautomatically creates the corresponding IP address reservation. If the providedIP address is reserved, the group assigns the reservation to the instance.

auto-delete
(Optional) Prescribes what should happen to an associated static Addressresource when a VM instance is permanently deleted. Regardless of the value ofthe delete rule, stateful IP addresses are always preserved on instanceautohealing, update, and recreation operations. The following options areavailable:
  • never: (Default) Never delete the static IPaddress. Instead, unassign the address when its instance is permanently deletedand keep the address reserved.
  • on-permanent-instance-deletion: Delete thestatic IP address reservation when the instance that it's assigned to ispermanently deleted from the instance group; for example, when the instance isdeleted manually or when the group size is decreased.
--stateful-metadata=KEY=VALUE,[KEY=VALUE,…]
Additional metadata to be made available to the guest operating system inaddition to the metadata defined in the instance template.

Stateful metadata may be used to define a key/value pair specific for the onegiven instance to differentiate it from the other instances in the managedinstance group.

Stateful metadata key/value pairs are preserved on instance recreation,autohealing, updates, and any other lifecycle transitions of the instance.

Stateful metadata have priority over the metadata defined in the instancetemplate. This means that stateful metadata that is defined for a key thatalready exists in the instance template overrides the instance template value.

Each metadata entry is a key/value pair separated by an equals sign. Metadatakeys must be unique and less than 128 bytes in length. Multiple entries can bepassed to this flag, e.g.,--stateful-metadatakey-1=value-1,key-2=value-2,key-3=value-3.

At most one of these can be specified:
--region=REGION
Region of the managed instance group to create instance in. If not specified,you might be prompted to select a region (interactive mode only).

A list of regions can be fetched by running:

gcloudcomputeregionslist

Overrides the defaultcompute/region property value for thiscommand invocation.

--zone=ZONE
Zone of the managed instance group to create instance in. If not specified, youmight be prompted to select a zone (interactive mode only).

A list of zones can be fetched by running:

gcloudcomputezoneslist

Overrides the defaultcompute/zone property 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 help for details.

NOTES
These variants are also available:
gcloudalphacomputeinstance-groupsmanagedcreate-instance
gcloudbetacomputeinstance-groupsmanagedcreate-instance

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-07-22 UTC.