- gcloud alpha compute instance-groups managed instance-configs create - create per instance config for managed instance group
gcloud alpha compute instance-groups managed instance-configs create NAME --instance=INSTANCE [--force-instance-update] [--stateful-disk=[device-name=DEVICE-NAME],[mode=MODE],[source=SOURCE]] [--stateful-metadata=KEY=VALUE,[KEY=VALUE,...]] [--region=REGION | --zone=ZONE] [GCLOUD_WIDE_FLAG ...]
(ALPHA) gcloud alpha compute instance-groups managed instance-configs
You can use this command on an instance that does not exist. In this case config will be added to the pool of per instance configs to utilise for creating new instances. Order of utilisation of these configs from the pool is non deterministic.
If created for existing instance, changes will be applied during next instance update or recreation - unless it is forced by --force-instance-update option.
When you create config for non existing instance in regional managed instance group, use the full URI to the instance - pointing to target zone. Just instance name will not be resolved.
Name of the managed instance group to create per instance config for.
URI to existing or non existing instance.
Name - last part of URI - will be preserved for existing per instance configs.
For zonal managed instance groups there is no need to specify the whole URI to the instance - for this case instance name can be applied instead of URI.
The changes will be applied immediately to the instances. If this flag is not
provided, the changes will be applied once the instances are restarted or
Example: let's say we have an instance with a disk attached to it and an override for the disk. If we decide to delete the override and provide this flag, this will instantly recreate the instance and detach the disk from it. Similarly if we have attached new disk or changed its definition - with this flag it will instantly recreate instance with newly applied overrides.
If we omit this flag, the instance will continue to exist with no overrides changes applied until it gets restarted or recreated either manually or by autohealer or updater.
Disks considered stateful by the instance group. Usually, the managed instance
group deletes disks when deleting instances; however, in the case of stateful
disks, these disks are detached from the deleted instance and attached to new
instances the managed instance group creates.
Besides preserving disks already attached to the instance by specifying only device names, user have an option to attach (and preserve) other existing persistent disk(s) to the given instance.
The same disk can be attached to many instances but only in read-only mode.
Use this argument multiple times to attach more disks.
Name under which disk is or will be attached.
Optional argument used to specify URI of existing persistent disk to attach
under specified device-name.
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.
Additional metadata to be made available to the guest operating system on top of
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 have priority over the metadata defined in the instance template. It means that stateful metadata defined for the keys already existing in the instance template override their values.
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.
At most one of these may be specified:
Region of the managed instance group to create per instance config for. If not
specified, you may be prompted to select a region.
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 of the managed instance group to create per instance config for. If not
specified, you may be prompted to select a zone.
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: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you will have to apply for early access and have your projects registered on the API whitelist to use it. To do so, contact Support at cloud.google.com/support