How to change machine type on Google Compute Engine. If you have a Compute Engine VM Instance running and serving live traffic and you need to upgrade your instance to higher machine without downtime, then this post is for you.
This guide will help you to upgrade or downgrade your VM instance without downtime.
Steps to Change Machine Type
- Reserve Static IP address of your VM Instance.
- Create a snapshot of your running Compute Engine Instance.
- Create new VM Instance with the created Snapshot with your Machine Type.
- Attach IP Address to new VM Instance.
- Delete old VM Instance.
Reserve Static IP Address
Go to VPC Network >> External IP addresses. If you haven’t reserved your IP address you will see your IP address listed here.
Click over the Ephemeral and select Static.
In the opened popup enter a name and click Reserve.
Now your IP address is reserved as static.
Create a Snapshot
Go to Compute Engine >> Snapshots.
Click Create Snapshot.
Enter a Name for your snapshot.
In Source Disk select the disk of the Instance.
It will take sometime to create depending on the size of your disk. Now you can create a new VM Instance with this snapshot.
Create New VM Instance from Snapshot
Now go to Compute Engine >> VM Instance and click Create Instance.
Important: Select the same region of your old VM Instance
In Machine type select your machine in the dropdown.
In Boot Disk click Change.
Click the Snapshot tab and choose the snapshot you have created before.
Select all the others that are in your old VM Instance and Click Create
Now your new VM Instance with new Machine type is up and running.
Attach IP Address to new VM Instance
Go to VPC Network >> External IP addresses.
Click Change on your static IP address.
In the Attach to select your new VM instance.
Wait for sometime for the changes to get effect.
Once the IP address get’s attached, your new VM Instance will serve traffic.
Now make sure everything is working fine and delete the old Instance.