gcloud alpha compute instances update Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud alpha compute instances update - update a Compute Engine virtual machine
- SYNOPSIS
gcloud alpha compute instances updateINSTANCE_NAME[--[no-]deletion-protection][--[no-]enable-display-device][--[no-]graceful-shutdown][--graceful-shutdown-max-duration=GRACEFUL_SHUTDOWN_MAX_DURATION][--min-cpu-platform=PLATFORM][--partner-metadata=[NAMESPACE/KEY=VALUE,…]][--partner-metadata-from-file=LOCAL_FILE_PATH][--[no-]shielded-integrity-monitoring][--shielded-learn-integrity-policy][--[no-]shielded-secure-boot][--[no-]shielded-vtpm][--update-labels=[KEY=VALUE,…]][--zone=ZONE][--clear-labels|--remove-labels=[KEY,…]][--clear-node-affinities|--node=NODE|--node-affinity-file=PATH_TO_FILE|--node-group=NODE_GROUP][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(ALPHA)gcloud alpha compute instances updateupdateslabels and requested CPU Platform for a Compute Engine virtual machine.- EXAMPLES
- To modify the instance 'example-instance' in 'us-central1-a' by adding labels'k0', with value 'value1' and label 'k1' with value 'value2' and removing labelswith key 'k3', run:
gcloudalphacomputeinstancesupdateexample-instance--zone=us-central1-a--update-labels=k0=value1,k1=value2--remove-labels=k3Labels can be used to identify the instance. To list instances with the'k1:value2' label, run:
gcloudalphacomputeinstanceslist--filter='labels.k1:value2'To list only the labels when describing a resource, use --format to filter theresult:
gcloudalphacomputeinstancesdescribeexample-instance--format="default(labels)" - POSITIONAL ARGUMENTS
INSTANCE_NAME- Name of the instance to update. For details on valid instance names, refer tothe criteria documented under the field 'name' at:https://cloud.google.com/compute/docs/reference/rest/v1/instances
- FLAGS
--[no-]deletion-protection- Enables deletion protection for the instance. Use
--deletion-protectionto enable and--no-deletion-protectionto disable. --[no-]enable-display-device- Enable a display device on VM instances. Use
--enable-display-deviceto enable and--no-enable-display-deviceto disable. --[no-]graceful-shutdown- Enables or disables graceful shutdown for the instance. Use
--graceful-shutdownto enable and--no-graceful-shutdownto disable. --graceful-shutdown-max-duration=GRACEFUL_SHUTDOWN_MAX_DURATION- Specifies the maximum time for the graceful shutdown. After this time, theinstance is set to STOPPING even if tasks are still running. Specify the time asthe number of hours, minutes, or seconds followed by h, m, and s respectively.For example, specify 30m for 30 minutes or 20m10s for 20 minutes and 10 seconds.The value must be between 1 second and 1 hour.
--min-cpu-platform=PLATFORM- When specified, the VM will be scheduled on host with specified CPU architectureor a newer one. To list available CPU platforms in given zone, run:
gcloudalphacomputezonesdescribeZONE--format="value(availableCpuPlatforms)"Default setting is "AUTOMATIC".
CPU platform selection is available only in selected zones.
You can find more information on-line:https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform
--partner-metadata=[NAMESPACE/KEY=VALUE,…]- Partner metadata specifying namespace and its entries. The entries can bekey-value pairs or in json format.
--partner-metadata-from-file=LOCAL_FILE_PATH- Path to a local json file containing partner metadata. Use a full or relativepath to a local file containing the value of partner_metadata.
--[no-]shielded-integrity-monitoring- Enables monitoring and attestation of the boot integrity of the instance. Theattestation is performed against the integrity policy baseline. This baseline isinitially derived from the implicitly trusted boot image when the instance iscreated. This baseline can be updated by using
gcloud compute instancesupdate --shielded-learn-integrity-policy. On Shielded VM instances,integrity monitoring is enabled by default. For information about how to modifyShielded VM options, seehttps://cloud.google.com/compute/docs/instances/modifying-shielded-vm.For information about monitoring integrity on Shielded VM instances, seehttps://cloud.google.com/compute/docs/instances/integrity-monitoring." Changesto this setting with the update command only take effect after stopping andstarting the instance. Use--shielded-integrity-monitoringtoenable and--no-shielded-integrity-monitoringto disable. --shielded-learn-integrity-policy- Causes the instance to re-learn the integrity policy baseline using the currentinstance configuration. Use this flag after any planned boot-specific changes inthe instance configuration, like kernel updates or kernel driver installation.
--[no-]shielded-secure-boot- The instance boots with secure boot enabled. On Shielded VM instances, SecureBoot is not enabled by default. For information about how to modify Shielded VMoptions, seehttps://cloud.google.com/compute/docs/instances/modifying-shielded-vm.Changes to this setting with the update command only take effect after stoppingand starting the instance. Use
--shielded-secure-bootto enable and--no-shielded-secure-bootto disable. --[no-]shielded-vtpm- The instance boots with the TPM (Trusted Platform Module) enabled. A TPM is ahardware module that can be used for different security operations such asremote attestation, encryption, and sealing of keys. On Shielded VM instances,vTPM is enabled by default. For information about how to modify Shielded VMoptions, seehttps://cloud.google.com/compute/docs/instances/modifying-shielded-vm.Changes to this setting with the update command only take effect after stoppingand starting the instance. Use
--shielded-vtpmto enable and--no-shielded-vtpmto disable. --update-labels=[KEY=VALUE,…]- List of label KEY=VALUE pairs to update. If a label exists, its value ismodified. Otherwise, a new label is created.
Keys must start with a lowercase character and contain only hyphens(
-), underscores (_), lowercase characters, andnumbers. Values must contain only hyphens (-), underscores(_), lowercase characters, and numbers. --zone=ZONE- Zone of the instance to update. If not specified, you might be prompted toselect a zone (interactive mode only).
gcloudattempts to identify theappropriate zone by searching for resources in your currently active project. Ifthe zone cannot be determined,gcloudprompts you for a selection withall available Google Cloud Platform zones.To avoid prompting when this flag is omitted, the user can set the
property:compute/zonegcloudconfigsetcompute/zoneZONEA list of zones can be fetched by running:
gcloudcomputezoneslistTo unset the property, run:
gcloudconfigunsetcompute/zoneAlternatively, the zone can be stored in the environment variable
.CLOUDSDK_COMPUTE_ZONE - At most one of these can be specified:
--clear-labels- Remove all labels. If
--update-labelsis also specified then--clear-labelsis applied first.For example, to remove all labels:
gcloudalphacomputeinstancesupdate--clear-labelsTo remove all existing labels and create two new labels,
andfoo:bazgcloudalphacomputeinstancesupdate--clear-labels--update-labelsfoo=bar,baz=qux --remove-labels=[KEY,…]- List of label keys to remove. If a label does not exist it is silently ignored.If
--update-labelsis also specified then--update-labelsis applied first.
- Sole Tenancy.
At most one of these can be specified:
--clear-node-affinities- Removes the node affinities field from the instance. If specified, the instancenode settings will be cleared. The instance will not be scheduled onto asole-tenant node.
--node=NODE- The name of the node to schedule this instance on.
--node-affinity-file=PATH_TO_FILE- The JSON/YAML file containing the configuration of desired nodes onto which thisinstance could be scheduled. These rules filter the nodes according to theirnode affinity labels. A node's affinity labels come from the node template ofthe group the node is in.
The file should contain a list of a JSON/YAML objects. For an example, seehttps://cloud.google.com/compute/docs/nodes/provisioning-sole-tenant-vms#configure_node_affinity_labels.The following list describes the fields:
key- Corresponds to the node affinity label keys of the Node resource.
operator- Specifies the node selection type. Must be one of:
IN: RequiresCompute Engine to seek for matched nodes.NOT_IN: Requires ComputeEngine to avoid certain nodes. values- Optional. A list of values which correspond to the node affinity label values ofthe Node resource.
Use a full or relative path to a local file containing the value ofnode_affinity_file.
--node-group=NODE_GROUP- The name of the node group to schedule this instance on.
- 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 helpfor details. - NOTES
- This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudcomputeinstancesupdategcloudbetacomputeinstancesupdate
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-05-07 UTC.