Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change a GCE VM instance type on the fly?

I'm working with Google Compute Engine and to test it I created a small instance type which isn't very powerful. Now I want to change it to a more powerful CPU but can't seem to figure out how to do that.

Is it possible to change the instance type of a running VM?

like image 821
Federico Sciarretta Avatar asked Jul 30 '13 23:07

Federico Sciarretta


People also ask

Can I move a GCE VM from one project to another?

Natively, once you have built Google Compute Engine (GCE) VMs, you are unable to easily move those VM resources into another project. There are a few how-to guides for leveraging disk snapshots, cloning, etc, but alot of those are difficult to operate at scale and open a plethora of potential issues in practice.

How to change the machine type of a VM instance?

To perform this task, you must have the following permissions: In the Google Cloud Console, go to the VM instances page. In the Name column, click the name of the instance for which you want to change machine type. Click the Stop button to stop the instance, if you have not stopped it yet. Select the VM instance to edit.

How to change machine type in Google cloud VM instance?

To perform this task, you must have the following permissions: In the Google Cloud Console, go to the VM instances page. In the Name column, click the name of the VM for which you want to change machine type.

How do I change the type of an EC2 instance?

1 (Optional) If the new instance type requires drivers that are not installed on the existing instance, you must connect to your instance and install the drivers first. ... 2 Open the Amazon EC2 console. 3 In the navigation pane, choose Instances . 4 Select the instance and choose Actions, Instance state, Stop instance . More items...


2 Answers

You can't change the instance type of a running instance, so you'll have to shut it down and start a new one.

If you used a persistent root disk, you can reuse that disk on your replacement instance. If you used a scratch disk though, you'll have to make sure you back up your changes first.

like image 137
Thomas Orozco Avatar answered Sep 18 '22 14:09

Thomas Orozco


In December 2013, Compute Engine was promoted to v1 (General Availability). Some notes to hopefully save folks time:

  • Scratch disks are deprecated. By default boot disks are now created as persistent.
  • Before you delete the old instance, save off its settings for easy reference when creating the new one:

    gcutil getinstance instance-name
    
  • The disk name to use later for addinstance is the last part of the disk.source setting.

  • If the disk.autoDelete setting is True, set it to False to preserve the disk:

    gcutil setinstancediskautodelete instance-name --auto_delete=False
    
  • Safely delete the old instance:

    gcutil deleteinstance instance-name
    
  • To create a new instance using the old instance's persistent disk as the boot disk, you need to specify the boot flag, e.g. using gcutil:

    gcutil addinstance --disk=instance-disk-name,mode=rw,boot [...]
    

    Otherwise it complains that the disk already exists and fails the instance creation.

like image 33
David Pope Avatar answered Sep 20 '22 14:09

David Pope