A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/compute/docs/instances/update-instance-properties below:

Update instance properties | Compute Engine Documentation

Skip to main content Update instance properties

Stay organized with collections Save and categorize content based on your preferences.

You can use a single request from the Google Cloud CLI or the Compute Engine API to update multiple instance properties and optionally restart the instance if necessary. The update method handles the logic for validating the updated instance properties and ensuring that the necessary resources are available to complete the update successfully. If the request includes invalid properties or if the requested resources are not available, the request returns an error and makes no changes to your instance. This protects the instance from partial updates and protects the instance from being stopped and unable to access resources to start up again.

To add or remove Dynamic Network Interfaces from an instance, (Preview), use the following procedures instead of updating the instance properties:

Before you begin Restrictions Permissions

You must have the compute.instances.update permission to update instances. This permission is included in several existing Identity and Access Management (IAM) roles. You must also have permission to use the resources that you want to modify on the instance. For example, to add a disk to an instance you must have the following permissions:

Best practices

To ensure that the instance update interface works most effectively for you, use the following best practices:

Properties that you can update

You can change only a specific set of instance properties through the update method. Updates to some properties require the instance to restart. To prevent accidental restarts on your instances, your request must define what action is allowed to be taken on your instances. Your request can specify one of the following actions:

The following properties require a restart (RESTART) to update:

The following properties only require a refresh (REFRESH) to update:

Update instance properties

Update your instances using the following steps:

  1. Export the existing instance configuration properties.
  2. Modify the properties of the instance configuration.
  3. Run a test request by specifying NO_EFFECT as the most disruptive action. The response indicates invalid fields in the instance configuration and indicates the action required to apply the changes.
  4. If the configuration is acceptable, request an instance update and specify the most disruptive action that is acceptable for your instance update.

The system starts the update process only if your request meets the following requirements:

If the requirements are met, the system starts the instance update process. Otherwise, the system makes no changes to your existing instance or its configuration.

You can initiate updates using either the gcloud CLI or the Compute Engine API.

gcloud
  1. Use the instances export command to export the existing instance properties:

    gcloud compute instances export INSTANCE_NAME \
        --project PROJECT_ID \
        --zone ZONE \
        --destination=FILE_PATH
    

    Replace the following:

  2. Use a text editor to modify one or more properties in the exported instance configuration file. To learn which properties you can update, see the list of updatable properties in this document. For example, to change the machine type of the instance, change the machineType property:

    ...
    machineType: https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/machineTypes/MACHINE_TYPE
    ...
    

    Replace the following:

    Tip: To avoid getting an error such as "ERROR: (gcloud.compute.instances.update-from-file) Cannot parse YAML: [Expected type for field value, found True (type )]" , add quotes (' ') around any label values of yes or no in the exported instance configuration file. This indicates the values are strings, not Boolean values.
  3. Use the instances update-from-file command to run a test update of the target instance. Specify the --most-disruptive-allowed-action=NO_EFFECT flag. The response identifies misconfigured properties and indicates whether a RESTART or REFRESH action is required to apply the update.

    gcloud compute instances update-from-file INSTANCE_NAME \
        --project PROJECT_ID \
        --zone ZONE \
        --source=FILE_PATH \
        --most-disruptive-allowed-action NO_EFFECT
    

    Replace the following:

  4. Use the instances update-from-file command to update the target instance. If you are updating a property that requires the instance to restart, include the --most-disruptive-allowed-action=RESTART flag. If the properties don't require a restart, specify the --most-disruptive-allowed-action=REFRESH flag. To learn which properties require a restart, see the updatable properties list in this document.

    gcloud compute instances update-from-file INSTANCE_NAME \
        --project PROJECT_ID \
        --zone ZONE \
        --source=FILE_PATH \
        --most-disruptive-allowed-action ALLOWED_ACTION
    

    Replace the following:

If the update request is valid and the required resources are available, the instance update process begins. You can monitor the status of this operation by viewing the audit logs. If the update requires a restart and your command allows for a RESTART, the instance restarts to apply the changes.

REST
  1. Use the instances.get method in the Compute Engine API to export the existing instance properties:

    GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
    

    Replace the following:

    This request returns an instance resource definition.

  2. In the response, modify the instance resource properties. To learn which properties are updatable, see the updatable properties list in this document. For example, to change the machine type of the instance, change the machineType property. You can change multiple properties.

    {
      ...
      "machineType": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/machineTypes/MACHINE_TYPE",
      ...
    }
    

    Replace the following:

  3. Use the instances.update method in the Compute Engine API and specify the mostDisruptiveAllowedAction=NO_EFFECT query parameter to run a test update of the target instance. The response identifies misconfigured properties and indicates if a RESTART or REFRESH action is required to apply the update.

    PUT https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME?mostDisruptiveAllowedAction=NO_EFFECT
    
    {
      ...
      "machineType": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/machineTypes/n1-standard-2",
      ...
    }
    

    Replace the following:

  4. Use the instances.update method in the Compute Engine API to update the target instance. If you are updating a property that requires an instance restart, include the mostDisruptiveAllowedAction=RESTART query parameter to indicate that the instance can be restarted during the update. If the properties don't require a restart, specify the mostDisruptiveAllowedAction=REFRESH query parameter. To learn which properties require a restart, see the updatable properties list in this document. Include the full body for the instance resource that you modified. In the following example, the body changes the machine type to n1-standard-2:

    PUT https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME?mostDisruptiveAllowedAction=ALLOWED_ACTION
    
    {
      ...
      "machineType": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/machineTypes/n1-standard-2",
      ...
    }
    

    Replace the following:

If the update request is valid and the required resources are available, the instance update process begins. You can monitor the status of this operation by viewing the audit logs. If the update requires a restart and your command allows for a RESTART, the instance restarts to apply the changes.

What's next

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 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["You can update multiple properties of a Compute Engine instance using a single request via the Google Cloud CLI or the Compute Engine API, with the option to restart the instance if necessary."],["The update process validates changes, checks resource availability, and prevents partial updates, ensuring that your instance is not left in an inconsistent state."],["Updates can be tested using the `NO_EFFECT` action, which checks validity without executing changes, and you can allow or prevent restarts using `RESTART` or `REFRESH` actions respectively."],["Only specific instance properties can be updated through this method, and some require an instance restart, while others can be updated with a refresh, and a full list is provided in the updatable properties list."],["The update process involves exporting the instance configuration, modifying the properties, testing the update, and then applying the update with the appropriate `most-disruptive-allowed-action`."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4