Practice Lab: Working with Virtual Machines and Networking in Google Cloud Platform

Nova Novriansyah
NovAI Cloud Computing — GCP
4 min readJun 9, 2024

Objective: In this practice lab, you will learn how to create and configure a Virtual Machine (VM) and set up basic networking in Google Cloud Platform (GCP). By the end of this lab, you will have a working VM and an understanding of how to configure networking components such as Virtual Private Cloud (VPC) networks, subnets, and firewall rules.

Part 1: Setting Up Your Google Cloud Account

  1. Create a Google Cloud Account:
  • Go to the Google Cloud Console.
https://console.cloud.google.com/
  • Sign in with your Google account. If you don’t have one, create a new Google account.

Using Cloud guru:

Note if you are using cloudguru, you can visit this url to get the credential

https://learn.acloud.guru/cloud-playground/cloud-sandboxes

Use the cloudguru credential to login to GCP on https://console.cloud.google.com/

Part 2: Creating a Virtual Machine

  1. Navigate to Compute Engine:
  • In the Google Cloud Console, open the navigation menu (hamburger icon) and go to “Compute Engine” > “VM instances.”

2. Create a New VM Instance:

  • Click the “Create” button.
  • Configure your VM:
  • Name: Enter my-first-vm.
  • Region and Zone: Select a region and zone close to your location.
  • Machine type: Choose a machine type (e.g., e2-micro for the free tier).
  • Boot disk: Select an operating system (e.g., Debian, Ubuntu).
  • Click “Create” to launch your VM.

3.Connect to Your VM:

  • Once the VM is created, it will appear in the list of VM instances.
  • Click the SSH button next to your VM instance to open a terminal window and connect to your VM.

Part 3: Configuring Networking

Step 1: Setting Up a VPC Network

  1. Navigate to VPC Network:
  • In the navigation menu, go to “VPC network” > “VPC networks.”

2. Create a New VPC Network:

  • Click “Create VPC network.”
  • Configure your VPC:
  • Name: Enter my-vpc2.
  • Subnet creation mode: Select “Custom.”
  • Click “Create.”

Step 2: Creating a Subnet

  1. Add a Subnet to Your VPC:
  • In the “Subnets” tab, click “Add subnet.”
  • Configure your subnet:
  • Name: Enter my-subnet.
  • Region: Select the same region as your VM.
  • IP address range: Enter 10.0.0.0/24.
  • Region:us-east1
  • Click “Create.”

Step 3: Configuring Firewall Rules

  1. Navigate to Firewall Rules:
  • In the navigation menu, go to “VPC network” > “Firewall.”

2. Create a New Firewall Rule:

  • Select my-vpc2-allow-ssh.
  • Click “Create.”

Part 4: Associating the VM with the VPC

  1. Stop Your VM Instance:
  • Navigate to “Compute Engine” > “VM instances.”
  • Select your VM and click “Stop.”

2. Edit the VM Configuration:

  • Once the VM is stopped, click on the VM name to open its details page.
  • Click “Edit.”
  • In the “Network interfaces” section, click “Edit.”
  • Change the “Network” to my-vpc2 and the "Subnet" to my-subnet.
  • Click “Done” and then “Save” to apply the changes.

3. Start Your VM Instance:

  • Click “Start” to restart your VM.

Congratulations! You have successfully created and configured a Virtual Machine and set up basic networking in Google Cloud Platform. In this practice lab, you learned how to create a VM, configure a VPC network, set up a subnet, and manage firewall rules to allow SSH access. These fundamental skills are essential for building and managing cloud infrastructure on GCP.

By understanding how to set up and configure VMs and networking components, you are now equipped to handle more complex scenarios and configurations in Google Cloud. Continue exploring GCP to leverage its full potential for your projects and applications.

--

--

Nova Novriansyah
NovAI Cloud Computing — GCP

C|CISO, CEH, CC, CVA,CertBlockchainPractitioner, Google Machine Learning , Tensorflow, Unity Cert, Arduino Cert, AWS Arch Cert. CTO, IT leaders. Platform owners