- 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
gcloud compute instance-groups managed create-instancecreates a virtual machine instance with a defined name and optionally its stateful configuration: stateful disk and stateful metadata key-values. Stateful configuration is stored in the corresponding newly created per-instance config. An instance with a per-instance config will preserve its given name, specified disks, and specified metadata key-values during instance recreation, auto-healing, and updates and any other lifecycle transitions of the instance.
- POSITIONAL ARGUMENTS
- Name of the managed instance group to create instance in.
- REQUIRED FLAGS
- Name of the new instance to create.
- OPTIONAL FLAGS
Disks considered stateful by the instance group. Managed instance groups
preserve and reattach stateful disks on VM autohealing, update, and recreate
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.
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.,
At most one of these may be specified:
Region of the managed instance group to create instance in. If not specified,
you may be prompted to select a region.
A list of regions can be fetched by running:
Overrides the default
compute/regionproperty value for this command invocation.
Zone of the managed instance group to create instance in. If not specified, you
may be prompted to select a zone.
A list of zones can be fetched by running:
Overrides the default
compute/zoneproperty value for this command invocation.
- GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account,
--log-http, --project, --quiet, --trace-token, --user-output-enabled,
$ gcloud helpfor details.
To create an instance
my-group(in region europe-west4) with metadata
my-key: my-valueand a disk disk-1 attached to it as the device
gcloud compute instance-groups managed create-instance my-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'
- These variants are also available:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-11-10 UTC.