Changing the Machine Type of a Stopped Instance

This page describes how to change the machine type of an existing instance. To learn more about machine types, read the Machine Types documentation.

You can change the machine type of a stopped instance if you find that your existing machine type is not a good fit for your workloads or if you intentionally started with a smaller machine type for setup, development, and testing and now wish to deploy the virtual machine instance for your production workload.

Before you begin


Changing a machine type

Changing a machine type does not affect the instance's persistent disk data, SSH keys, or any other instance configurations such as instance metadata. If your instance uses an ephemeral external IP address, there is a possibility that the IP address might change. To keep the IP address from changing, promote it to a static external IP address.

To change the machine type of a stopped instance, use the Google Cloud Platform Console, the setMachineType method in the API, or the instances set-machine-type command in gcloud. You can only change the machine type of a stopped instance and an instance is considered stopped only when the instance is in the TERMINATED state. It is not possible to change the machine type of a running instance.


  1. Go to the VM Instances page.
  2. In the Name column, click the name of the instance that you want to change the machine type for. The instance details appear.
  3. Click the Stop button to stop the instance, if you have not stopped it yet.
  4. After the instance stops, click the Edit button at the top of the page.

    Screenshot of Edit button

  5. Under the Machine Type section, select the machine type you want to use, or create a custom machine type.

    Screenshot of changing a machine type

  6. Save your changes.


To change a machine type in gcloud, run the following command, replacing INSTANCE with the instance name, and MACHINE-TYPE with the desired machine type:

gcloud compute instances set-machine-type INSTANCE --machine-type MACHINE-TYPE

Your machine type can be a predefined machine type, such as n1-standard-1, or a custom machine type. For example, a custom machine type with 4 vCPUs and 1 GB of memory can be specified as:

--machine-type custom-4-1024


In the API, make a POST request with the desired machine type in the request body:


    machineType: "zones/us-central1-f/machineTypes/n1-standard-1"

To declare a custom machine type, use the format:


For example, this machine type has 4 vCPUs and 1 GB of memory:


Moving to a smaller machine type

If you move from a machine type with more resources to a machine type with fewer resources, such as moving from a n1-standard-8 machine type to a n1-standard-2, you could run into hardware resource issues or performance limitations because smaller machine types are less powerful than larger machine types. Make sure that your new machine type is able to support any applications or services that are currently running on the instance, or that you update your services and applications to run on the smaller machine types.

Billing implications

Each machine type is billed at a different rate, so make sure you understand the pricing implications of changing machine types. For example, an n1-standard-1 machine type costs more than an f1-micro machine type.

Changing a machine type can also affect your sustained use discounts. Sustained use discounts are based on inferred instances of the same machine type in the same zone, so if you change machine types, the subsequent running time of the virtual machine instance will count towards the sustained use discount of the new machine type.

For example, assume you have an instance with n1-standard-1 machine type running for half a month. You then decide to change the machine type to n1-standard-2. Once you make that change, Compute Engine starts counting the running time of the virtual machine instance from that point on towards the sustained use discount of the n1-standard-2 machine type.

On your bill, you would see a sustained use discount applied to the n1-standard-1 machine type from before you made the machine type change, and a separate sustained use discount for n1-standard-2, if your instance remains running on n1-standard-2 for at least a 25% of the rest of the month.

Best practices

It is good practice to make regular backups of your persistent disk data using snapshots. Consider taking a snapshot of your persistent disk data before you change the machine type. If you want to make sure the new machine type is able to support the data on the existing virtual machine instance, you can take a persistent disk snapshot and use it to start a second virtual machine instance with the new machine type to confirm that the instance will start up sucessfully.

If you have a second persistent disk attached to your instance, make sure it is added to the /etc/fstab file so that it is automatically mounted when the instance reboots.

Send feedback about...

Compute Engine Documentation