gcloud compute instances set-machine-type INSTANCE_NAME [--machine-type=MACHINE_TYPE] [--zone=ZONE] [--custom-cpu=CUSTOM_CPU --custom-memory=CUSTOM_MEMORY : --custom-extensions --custom-vm-type=CUSTOM_VM_TYPE] [GCLOUD_WIDE_FLAG …]
gcloud compute instances set-machine-type
lets you change the machine type of a virtual machine in the
TERMINATED state (that is, a virtual machine instance that has been
stopped).
For example, if is a
example-instance virtual machine currently in the
g1-smallTERMINATED state, running:
gcloud compute instances set-machine-type example-instance --zone us-central1-b --machine-type n1-standard-4
will change the machine type to
, so that when you next start
n1-standard-4, it will be provisioned as
an example-instance instead of a
n1-standard-4.
g1-small
n1-standard-4, run:
gcloud compute instances set-machine-type example-instance --zone=us-central1-b --machine-type=n1-standard-4INSTANCE_NAME--machine-type=MACHINE_TYPE--zone=ZONEgcloud attempts to identify the
appropriate zone by searching for resources in your currently active project. If
the zone cannot be determined, gcloud prompts you for a selection with
all available Google Cloud Platform zones.
To avoid prompting when this flag is omitted, the user can set the
property:
compute/zone
gcloud config set compute/zone ZONEA list of zones can be fetched by running:
gcloud compute zones listTo unset the property, run:
gcloud config unset compute/zoneCLOUDSDK_COMPUTE_ZONE.
Custom machine type extensions.
--custom-cpu=CUSTOM_CPU
For some machine types, shared-core values can also be used. For example, for E2
machine types, you can specify micro, small, or
medium.
--custom-memory=CUSTOM_MEMORY--custom-extensions--custom-vm-type=CUSTOM_VM_TYPEn1. For more
information about custom machine types, see: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types
--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.
gcloud alpha compute instances set-machine-typegcloud beta compute instances set-machine-typegcloud preview compute instances set-machine-type
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 2026-05-27 UTC.