gcloud compute instance-groups managed instance-configs create

NAME
gcloud compute instance-groups managed instance-configs create - create a per-instance config for an instance in a managed instance group
SYNOPSIS
gcloud compute instance-groups managed instance-configs create NAME --instance=INSTANCE [--instance-update-minimal-action=INSTANCE_UPDATE_MINIMAL_ACTION; default="none"] [--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,…]] [--no-update-instance] [--region=REGION     | --zone=ZONE] [GCLOUD_WIDE_FLAG]
DESCRIPTION
gcloud compute instance-groups managed instance-configs create creates a per-instance config for an instance controlled by a Compute Engine managed instance group. An instance with a per-instance config preserves the specified metadata and/or disks during instance recreation and deletion.

Once created, the config is applied immediately to the corresponding instance, by performing the necessary action (for example, REFRESH), unless overridden by providing the --no-update-instance flag.

EXAMPLES
To create a per-instance config with a stateful disk my-disk and to add stateful metadata my-key:my-value, on instance my-instance, run:
gcloud compute instance-groups managed instance-configs create my-group --region=europe-west4 --instance=my-instance --stateful-disk=device-name=my-disk,source=projects/my-project/zones/us-central1-a/disks/my-disk-3 --stateful-metadata="my-key=my-value"

If my-disk did not exist previously in the per-instance config, and if it does not exist in the group's instance template, then the command adds my-disk to my-instance.

To create a per-instance config with a stateful internal IP 192.168.0.10 and a stateful external IP reserved in address my-address, on instance my-instance, run:

gcloud compute instance-groups managed instance-configs create my-group --region=europe-west4 --instance=my-instance --stateful-internal-ip=address=192.168.0.10,interface-name=nic0 --stateful-external-ip=address=/projects/example-project/regions/europe-west4/addresses/my-address,interface-name=nic0

If the provided IP address is not yet reserved, the MIG automatically creates a corresponding IP address reservation.

POSITIONAL ARGUMENTS
NAME
Name of the managed instance group to create a per-instance config for.
REQUIRED FLAGS
--instance=INSTANCE
URI/name of an existing instance in the managed instance group.
OPTIONAL FLAGS
--instance-update-minimal-action=INSTANCE_UPDATE_MINIMAL_ACTION; default="none"
Perform at least this action on the instance while updating, if --update-instance is set to true. INSTANCE_UPDATE_MINIMAL_ACTION must 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 machine type.
replace
Replace old VMs according to the --replacement-method flag.
--stateful-disk=[auto-delete=AUTO-DELETE],[device-name=DEVICE-NAME],[mode=MODE],[source=SOURCE]
Disks considered stateful by the instance group. Managed instance groups preserve and reattach stateful disks on VM autohealing, update, and recreate events.

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

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

Use this argument multiple times to attach and preserve multiple disks.
device-name
Name under which disk is or will be attached.
source
Optional argument used to specify the URI of an existing persistent disk to attach under specified device-name.
mode
Specifies the mode of the disk to attach. Supported options are ro for read-only and rw for read-write. If omitted when source is specified, rw is used as a default. mode can only be specified if source is given.
auto-delete
(Optional) Specifies the auto deletion policy of the stateful disk. The following options are available:
  • never: (Default) Never delete this disk. Instead, detach the disk when its instance is deleted.
  • on-permanent-instance-deletion: Delete the stateful disk when the instance that it's attached to is permanently deleted from the group; for example, when the instance is deleted manually or when the group size is decreased.
--stateful-external-ip=[address=ADDRESS],[auto-delete=AUTO-DELETE],[interface-name=INTERFACE-NAME]
Managed instance groups preserve stateful IPs on VM autohealing, update, and recreate events.

You can preserve the IP address that's specified in a network interface for a specific managed instance, even if that network interface is not defined in the group's instance template.

Use this argument multiple times to attach and preserve multiple IPs.

interface-name
(Optional) Network interface name. If omitted, the default network interface named nic0 is assumed.
*address*::: Static IP address to assign to the instance in one of
the following formats:

+ 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 group automatically creates the corresponding IP address reservation. If the provided IP address is reserved, the group assigns the reservation to the instance.

auto-delete
(Optional) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. Regardless of the value of the delete rule, stateful IP addresses are always preserved on instance autohealing, update, and recreation operations. The following options are available:
  • never: (Default) Never delete the static IP address. Instead, unassign the address when its instance is permanently deleted and keep the address reserved.
  • on-permanent-instance-deletion: Delete the static IP address reservation when the instance that it's assigned to is permanently deleted from the instance group; for example, when the instance is deleted 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, and recreate events.

You can preserve the IP address that's specified in a network interface for a specific managed instance, even if that network interface is not defined in the group's instance template.

Use this argument multiple times to attach and preserve multiple IPs.

interface-name
(Optional) Network interface name. If omitted, the default network interface named nic0 is assumed.
*address*::: Static IP address to assign to the instance in one of
the following formats:

+ 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 group automatically creates the corresponding IP address reservation. If the provided IP address is reserved, the group assigns the reservation to the instance.

auto-delete
(Optional) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. Regardless of the value of the delete rule, stateful IP addresses are always preserved on instance autohealing, update, and recreation operations. The following options are available:
  • never: (Default) Never delete the static IP address. Instead, unassign the address when its instance is permanently deleted and keep the address reserved.
  • on-permanent-instance-deletion: Delete the static IP address reservation when the instance that it's assigned to is permanently deleted from the instance group; for example, when the instance is deleted 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 in addition to the metadata defined in the instance template.

Stateful metadata may be used to define a key/value pair specific for the one given instance to differentiate it from the other instances in the managed instance 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 instance template. This means that stateful metadata that is defined for a key that already exists in the instance template overrides the instance template value.

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

--update-instance
Apply the configuration changes immediately to the instance. If you disable this flag, the managed instance group will apply the configuration update when you next recreate or update the instance.

Example: say you have an instance with a disk attached to it and you created a stateful configuration for the disk. If you decide to delete the stateful configuration for the disk and you provide this flag, the group immediately refreshes the instance and removes the stateful configuration for the disk. Similarly if you have attached a new disk or changed its definition, with this flag the group immediately refreshes the instance with the new configuration.

Enabled by default, use --no-update-instance to disable.

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

A list of regions can be fetched by running:

gcloud compute regions list

Overrides the default compute/region property value for this command invocation.

--zone=ZONE
Zone of the managed instance group to create a per-instance config for. If not specified, you might be prompted to select a zone (interactive mode only).

A list of zones can be fetched by running:

gcloud compute zones list

Overrides the default compute/zone property value for this command invocation.

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:
gcloud alpha compute instance-groups managed instance-configs create
gcloud beta compute instance-groups managed instance-configs create