Ends in
00
days
00
hrs
00
mins
00
secs
SHOP NOW

🧑‍💻 AWS Foundation Sale - Certified Cloud & AI Practitioner Mock Exams for only $12.99 each!

Back to Course

GCP PlayCloud Labs

0% Complete
0/0 Steps
  1. GCP PlayCloud Labs
  2. Guided Lab: How to Launch a GCP Compute Engine Linux Instance
  3. Guided Lab: Creating a VM Using Instance Templates
  4. Guided Lab: Creating and Managing Instance Groups in Compute Engine
  5. Guided Lab: Creating a Spot VM Instance
  6. Guided Lab: Configuring Shielded VM Options
  7. Guided Lab: Exploring Instance Metadata in Google Cloud
  8. Guided Lab: Vertically Scaling a VM Instance
  9. Guided Lab: Setting up a Web Server on a VM Instance
  10. Guided Lab: Using Startup Scripts in GCP VM Instances
  11. Guided Lab: Creating a Custom Image from a VM Instance with Web Server in Google Cloud
  12. Guided Lab: Creating VM Snapshots and Restoring a VM from a Snapshot
  13. Guided Lab: Setting Up and Managing a Database on a VM Instance
  14. Guided Lab: Installing WordPress on an Ubuntu VM Instance with LEMP Stack
  15. Guided Lab: Deploying a LAMP Stack on a Compute Engine VM
  16. Guided Lab: Reserving or Promoting a Static IP Address for a VM Instance
  17. Guided Lab: SSH Access to GCP VM Instance from Local Machine using SSH Key Pair
  18. Guided Lab: Guarding Your VM with Deletion Protection
  19. Guided Lab: Setting Up a Linux Bastion Host on GCP
  20. Guided Lab: Creating a Cloud Storage Bucket
  21. Guided Lab: Uploading, Organizing, and Managing Objects in Cloud Storage
  22. Guided Lab: Exploring Google Cloud Storage Classes
  23. Guided Lab: Hosting a Static Website in Google Cloud Storage Bucket
  24. Guided Lab: Protecting Data on Cloud Storage Bucket Against Accidental Delete and Overwrite Using Object Versioning
  25. Guided Lab: Using Cloud Storage Lifecycle Rules to Automate Object Management
  26. Guided Lab: Managing Cloud Storage Buckets via SSH Commands
  27. Guided Lab: Creating a Cloud SQL Instance
  28. Guided Lab: Running SQL Commands in Cloud SQL Studio
  29. Guided Lab: Creating and Restoring Cloud SQL Backups
  30. Guided Lab: Integrating Cloud SQL Database instance with a VM instance
  31. Guided Lab: Connecting Cloud SQL Database with MySQL Workbench (Local)
  32. Guided Lab: Guarding Your Cloud SQL Instances with Deletion Protection
  33. Guided Lab: Creating a Cloud NAT Gateway
  34. Guided Lab: Creating a Google Kubernetes Engine (GKE) Cluster
  35. Guided Lab: Connecting to a Kubernetes Engine Cluster
  36. Guided Lab: Deploying a Simple Web Application on GKE
  37. Guided Lab: Creating a Custom Virtual Private Cloud (VPC)
  38. Guided Lab: Establishing VPC Peering for Secure Cross‑Network Communication
  39. Guided Lab: Configuring Firewall Rules to Secure and Access a VM
  40. Guided Lab: Creating an Application Load Balancer
  41. Guided Lab: Creating a Network Load Balancer
Lesson 8 of 41
In Progress

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 lscpu and free -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.

Skip to content