Resize servers on Google Cloud
Use this guide to change the vCPUs, memory, and disk size of servers at Google Cloud.
Change a server’s machine type
A server’s machine type determines the server’s number of vCPUs and amount of memory.
- In Google Cloud console, go to the VM Instances page.
- Click on the name of the server.
- Click on Stop. If you don’t see Stop, click on the three blue vertical dots to the left of the icon.
- In the confirmation dialog, click Stop.
- Wait for the server’s status to change to “Stopped”.
- Click on Edit.
- Scroll down to Machine type and select the new machine type.
- Click Save.
- Click Start / Resume.
Set shell variables for the instance name of the server and the new machine type.
INSTANCE_NAME="my-first-server"MACHINE_TYPE="e2-standard-4"
Stop the server.
gcloud compute instances stop "${INSTANCE_NAME}"
Update the new machine type.
gcloud compute instances set-machine-type "${INSTANCE_NAME}" \ --machine-type="${MACHINE_TYPE}"
Start the server.
gcloud compute instances start "${INSTANCE_NAME}"
Resize a server’s disk
You can only increase the size of a server’s disk. You can’t decrease the disk size.
- In Google Cloud console, go to the Compute Engine Disks page.
- Click on the name of the disk. The disk name will usually be the same as the name of the server.
- Click on Edit. If you don’t see Edit, click on the three blue vertical dots to the left of the icon.
- In the Size field, enter the new disk size.
- Click on Save.
- In Google Cloud console, go to the VM Instances page.
- Click on the name of the server.
- Click on Stop. If you don’t see Stop, click on the three blue vertical dots to the left of the icon.
- In the confirmation dialog, click Stop.
- Wait for the server’s status to change to “Stopped”.
- Click Start / Resume.
Set shell variables for the instance name of the server and the new machine type. The disk size is in gigabytes (GB).
INSTANCE_NAME="my-first-server"DISK_SIZE="60"
Resize the disk. Even though the disk can be resized before the server is stopped, the additional disk space will not be detected by the operating system until the server is rebooted.
gcloud compute disks resize "${INSTANCE_NAME}" \ --size="${DISK_SIZE}"
Stop the server.
gcloud compute instances stop "${INSTANCE_NAME}"
Start the server.
gcloud compute instances start "${INSTANCE_NAME}"