GCP PlayCloud Labs
-
GCP PlayCloud Labs
-
Guided Lab: How to Launch a GCP Compute Engine Linux Instance
-
Guided Lab: Creating a VM Using Instance Templates
-
Guided Lab: Creating and Managing Instance Groups in Compute Engine
-
Guided Lab: Creating a Spot VM Instance
-
Guided Lab: Configuring Shielded VM Options
-
Guided Lab: Exploring Instance Metadata in Google Cloud
-
Guided Lab: Vertically Scaling a VM Instance
-
Guided Lab: Setting up a Web Server on a VM Instance
-
Guided Lab: Using Startup Scripts in GCP VM Instances
-
Guided Lab: Creating a Custom Image from a VM Instance with Web Server in Google Cloud
-
Guided Lab: Creating VM Snapshots and Restoring a VM from a Snapshot
-
Guided Lab: Setting Up and Managing a Database on a VM Instance
-
Guided Lab: Installing WordPress on an Ubuntu VM Instance with LEMP Stack
-
Guided Lab: Deploying a LAMP Stack on a Compute Engine VM
-
Guided Lab: Reserving or Promoting a Static IP Address for a VM Instance
-
Guided Lab: SSH Access to GCP VM Instance from Local Machine using SSH Key Pair
-
Guided Lab: Guarding Your VM with Deletion Protection
-
Guided Lab: Setting Up a Linux Bastion Host on GCP
-
Guided Lab: Creating a Cloud Storage Bucket
-
Guided Lab: Uploading, Organizing, and Managing Objects in Cloud Storage
-
Guided Lab: Exploring Google Cloud Storage Classes
-
Guided Lab: Hosting a Static Website in Google Cloud Storage Bucket
-
Guided Lab: Protecting Data on Cloud Storage Bucket Against Accidental Delete and Overwrite Using Object Versioning
-
Guided Lab: Using Cloud Storage Lifecycle Rules to Automate Object Management
-
Guided Lab: Managing Cloud Storage Buckets via SSH Commands
-
Guided Lab: Creating a Cloud SQL Instance
-
Guided Lab: Running SQL Commands in Cloud SQL Studio
-
Guided Lab: Creating and Restoring Cloud SQL Backups
-
Guided Lab: Integrating Cloud SQL Database instance with a VM instance
-
Guided Lab: Connecting Cloud SQL Database with MySQL Workbench (Local)
-
Guided Lab: Guarding Your Cloud SQL Instances with Deletion Protection
-
Guided Lab: Creating a Cloud NAT Gateway
-
Guided Lab: Creating a Google Kubernetes Engine (GKE) Cluster
-
Guided Lab: Connecting to a Kubernetes Engine Cluster
-
Guided Lab: Deploying a Simple Web Application on GKE
-
Guided Lab: Creating a Custom Virtual Private Cloud (VPC)
-
Guided Lab: Establishing VPC Peering for Secure Cross‑Network Communication
-
Guided Lab: Configuring Firewall Rules to Secure and Access a VM
-
Guided Lab: Creating an Application Load Balancer
-
Guided Lab: Creating a Network Load Balancer
Guided Lab: Vertically Scaling a VM Instance
Description
Google Cloud Compute Engine is a computing and hosting service that enables you to create and run virtual machines on Google’s infrastructure. Similar to Amazon EC2 and Azure Virtual Machines, it provides flexible options for deploying workloads. Compute Engine delivers scalability, high performance, and cost efficiency, allowing you to launch large compute clusters quickly without any upfront investment.
In this guided lab, you will learn how to vertically scale a virtual machine (VM) instance in Google Cloud. Vertical scaling means increasing the resources (CPU, memory, or machine type) of an existing VM to handle more workload without creating additional instances.
Prerequisites
To ensure the successful completion of this lab, you must have prior experience in creating VM instances and be familiar with their essential components. If you feel that your knowledge in this area is insufficient, we highly recommend taking this lab to gain the necessary understanding:
Objectives
In this lab, you will:
- Create a VM instance.
- Connect to a VM instance via SSH and check its current CPU and memory resources using
lscpuandfree -h. - Stop a running VM instance.
- Modify the machine type to increase CPU and memory.
- Restart the VM with the new configuration.
- Validate the scaled resources by comparing them against the baseline values.
Lab Steps
Create a Compute Engine Instance
1. Create a VM instance using the following machine configurations:
- Name: Enter your desired instance name.
- Machine type: Choose e2-micro (Preset)

2. Leave other configurations at their default values.
3. Once done, click the Create button.
Check Current VM Resources
1. In the Google Cloud Console, go to Compute Engine → VM instances.
2. Click SSH next to your VM instance to open a terminal session.

3. Run the following commands to check CPU and memory:
lscpu
free -h
4. Note the current number of CPU cores and available memory. This will serve as your baseline before scaling the VM.


Stop the VM Instance
1. Select the instance by clicking its name.
2. At the top of the page, click Stop.

3. Wait until the instance status changes to Stopped.

⚠️ You must stop the VM before changing its machine type.
Change the Machine Type
1. With the instance stopped, click Edit at the top of the page.

2. Scroll down to the Machine configuration section.

3. From the Machine type dropdown, select a larger configuration (e.g., from e2-micro to e2-medium).

This increases CPU cores and memory.
4. Click Save.
Restart the VM
1. After saving, click Start to restart the instance.

2. Wait until the status changes to Running.
Validate the Scaled Resources
1. Connect to the VM via SSH from the console.
2. Run the following command to check CPU and memory.
lscpu
free -h


3. You may also check the Machine Configuration to verify the new machine type.

4. Verify that the output reflects the new machine type with increased resources.
That’s it! You have successfully vertically scaled a VM instance in Google Cloud. You began by checking the baseline CPU and memory resources, then stopped the VM, changed its machine type to increase capacity, restarted it, and validated the new configuration against the original values. This workflow demonstrates how vertical scaling allows you to handle more demanding workloads while clearly showing the before‑and‑after impact of scaling.