NAME

gcloud compute instance-groups managed instance-configs update - update per-instance config of a managed instance group

SYNOPSIS

gcloud compute instance-groups managed instance-configs update NAME --instance=INSTANCE [--instance-update-minimal-action=INSTANCE_UPDATE_MINIMAL_ACTION; default="none"] [--remove-stateful-disks=DEVICE_NAME,[DEVICE_NAME,...]] [--remove-stateful-metadata=KEY,[KEY,...]] [--stateful-disk=[auto-delete=AUTO-DELETE],[device-name=DEVICE-NAME],[mode=MODE],[source=SOURCE]] [--stateful-metadata=KEY=VALUE,[KEY=VALUE,...]] [--no-update-instance] [--region=REGION | --zone=ZONE] [GCLOUD_WIDE_FLAG ...]

DESCRIPTION

gcloud compute instance-groups managed instance-configs update updates the per-instance config of an instance controlled by a Compute Engine managed instance group. The command lets you change the list of instance-specific stateful resources, that is, the list of resources that are preserved during instance restarts and recreations.

Changes are applied immediately to the corresponding instances, by performing the necessary action (for example, REFRESH), unless overridden by providing the --no-update-instance flag.

EXAMPLES

To updates the stateful disk my-disk-3 to the image provided by source, and clear my-disk1 and my-disk2 as stateful disks, and to add stateful metadata my-key: my-value, on instance my-instance, run:

$ gcloud compute instance-groups managed instance-configs update \ my-group --region=europe-west4 --instance=my-instance \ --stateful-disk=device-name=my-disk-3,source=projects/\ my-project/zones/us-central1-a/disks/my-disk-3 \ --remove-stateful-disks=my-disk-1,my-disk-2 \ --stateful-metadata='my-key=my-value'

If my-disk-3 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-3 to my-instance. The command also removes stateful configuration for my-disk-1 and my-disk-2; if these disk are not defined in the group's instance template, then they are detached.

POSITIONAL ARGUMENTS

NAME

Name of the managed instance group to update 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.

--remove-stateful-disks=DEVICE_NAME,[DEVICE_NAME,...]

Remove stateful configuration for the specified disks from the instance's configuration.

--remove-stateful-metadata=KEY,[KEY,...]

Remove stateful configuration for the specified metadata keys from the instance's configuration.

--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 update multiple disks.

If stateful disk with given device-name exists in current instance configuration, its properties will be replaced by the newly provided ones. In other case new stateful disk definition will be added to the instance configuration.

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

If stateful metadata with the given key exists in current instance configuration, its value will be overridden with the newly provided one. If the key does not exist in the current instance configuration, a new key/value pair will be added.

--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 update 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 update 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 \ update

$ gcloud beta compute instance-groups managed instance-configs update