Google Cloud virtual machine GSP001: Creating a Virtual Machine 2024

Guide to Google Cloud Virtual Machine GSP001: Creating a Virtual Machine (2024)

Google Cloud virtual machine GSP001: Creating a virtual machine (VM) in Google Cloud is an essential step for deploying applications, testing environments, and running various workloads. This guide will help you understand how to create a virtual machine using Google Cloud Platform (GCP).

Google Cloud virtual machine Objectives : 

  • Understand the basics of the Google Cloud Platform.
  • Learn how to create a virtual machine using the GCP Console.
  • Configure the VM settings according to your needs.
  • Install an NGINX web server.
  • Create a new instance with gcloud.

Google Cloud virtual machine Prerequisites :

  • A Google Cloud Platform account.
  • Basic understanding of cloud computing concepts.
  • Familiarity with the GCP Console.

ALSO READ: 

Action Plan

Step 1: Sign in to Google Cloud Platform

Go to the Google Cloud Platform Console.
Sign in with your Google account credentials.

Step 2: Activate Cloud Shell

Open the Cloud Shell by clicking on the terminal icon in the top-right corner of the console.
List the active account name (Optional):

gcloud auth list

Click on Authorize.

Step 3: Set a Project Region

Set the project region:

gcloud config set compute/region REGION

Create a variable for the region:

export REGION=REGION

Create a variable for the zone:

export ZONE=ZONE

Set a project region for this lab

Step 4: Navigate to the Compute Engine

In the GCP Console, use the left-hand navigation menu to “Compute Engine.”
Click on “VM instances.”

Navigate to the Compute Engine

Step 5: Create a VM Instance

Click on the “Create Instance” button.
Configure the following settings:
Name: Enter a name for your VM. 
Region and Zone: Choose the region and zone where your VM will be hosted.
Machine Type: 2 vCPU.
Boot Disk: New 10 GB balanced persistent disk with OS Image Debian GNU/Linux 11 (bullseye).
Firewall: Allow HTTP traffic.
Review your settings to ensure everything is configured correctly.
Click on the “Create” button to launch your VM.

Create a VM Instance

Step 6: Accessing Your VM

Once the VM is created, it will appear in the VM instances list.
Click on the SSH button next to your VM to open an SSH session in your browser.

Click on the SSH button next to your VM to open an SSH session in your browser.

Step 7: Install an NGINX Web Server

Update the package lists:
sudo apt-get update
Install NGINX:
sudo apt-get install -y nginx
Verify the NGINX process is running:
ps auwx | grep nginx

Step 8: Create a New Instance with gcloud

In the Cloud Shell, use gcloud to create a new virtual machine (VM) from the command line:
gcloud compute instances create gcelab2 –machine-type e2-medium –zone=$ZONE

In the Cloud Shell, use gcloud to create a new virtual machine (VM) from the command line:

Google Cloud virtual machine GSP001: Creating a Virtual Machine 2024

We have successfully created a virtual machine instance on the Google Cloud Platform and installed NGINX.

Thank you!

Leave a Comment