Create your first Virtual Machine in GCP

I’ll show you how to create a basic virtual machine on the Google Cloud Platform (GCP) in this article. I will begin with a brief review of Google Cloud Platform, and then I’ll teach you how to use Google Cloud Platform to build virtual machine instances. Let’s get going.

Read this blog post or watch the video below to learn how to create a Virtual Machine in Google Cloud Platform.

Down Arrow

Overview of Google Cloud Platform

The Google Cloud Platform is a collection of physical and virtual assets, including computers, hard drives, and CPUs, that are housed in Google Cloud data centres. Each data centre is located in a worldwide region, which is comprised of zones. Within the same territory, each zone is segregated from the others.
This distribution gives us several benefits, such as data redundancy in the event of a zone failure, lower latency by placing resources closer to the client, and more control over resources and how they may be used to improve service and lower costs.

Because this is a cloud platform, you won’t have to bother about purchasing and building hardware or data centres. You may use all of Google’s hardware and software as services. These services in Google Cloud Platform give you access to the underlying hardware. When you begin working, you will find that your product is simply a mix of Google services and your code.

What is Virtual Machine and Google Compute Engine (GCE) ?

When you deploy your app, you need servers. In the cloud environment, you need virtual servers to deploy and run your app. Google Compute Engine (GCE) will provision and maintain the virtual machines.

Virtual machines on Google Computing Engine deliver on-demand, high-scale performance and value, allowing you to quickly deploy massive compute clusters on Google’s infrastructure using Windows Server or Red Hat Enterprise Linux or any Operating system of your choice.

Google Compute Engine

Features of Google Compute Engine (GCE)

Steps to create Virtual Machine in Google Cloud Platform (GCP)

Step 1

Inside the Google Cloud console, search for virtual machine by typing “vm” and then choose VM Instances. In the next page, click on the “Create Instance” button.

Step 2

Now, we need to configure our virtual machine. Below are the basic configuration to start with

    • NamePlace to put a name to our virtual machine
    • LabelsIt’s a key/value pair to indicate different environments, services, teams and so on. Few examples –
      • environment: dev
      • app: service
      • bu: bank
    • RegionsThis is the place to choose the region and zones where you want to deploy your application. To understand the concept of Regions and Zones, please read my previous blog post here
    • Machine configurationThis time we need to select the type of machine we need. GCP provides three different types of machine configuration based on the need. Pricing and discount will also change based on the machine type you choose.
      • General Purpose: This is mainly used for common workloads, optimized for cost and flexibility.
      • Compute Optimised: These are high-performance machine types used for compute-intensive workloads.
      • Memory Optimised: These are large-memory machine types used for memory-intensive workloads.
    • Boot diskHere we will select the type of operating select we want for our virtual machine. Google Cloud provides different types of public images to select. For example: Debian, Red Hat, CentOS, Ubuntu, Windows Server etc.
    • Identity and API accessThis time we will select the service account and level of API access. Any applications which will run on VM uses the service account to call Google Cloud APIs. For simplicity, let’s select below two
      • Allow HTTP traffic
      • Allow HTTPS traffic
    • NetworkingUnder this, we can select the network, subnetwork, primary internal IP, external IP etc.
    • DisksHere we can add additional disk/storage in our virtual machine with additional cost.

There are a couple of more configurations we can set on this page, but for simplicity, I just select the basic one to start with. 

Finally, we need to click on “Create” button

Finally

Our first Virtual Machine is up and running in Google Cloud Platform.

Start, Stop, Delete Virtual Machine in Google Cloud Platform (GCP)

Once we have our Virtual Machine ready, we can go to the console to view it. For each virtual machine, there are three vertical dots(as shown in the picture below) clicking on that we will get the option to start, stop or delete our virtual machine.

Note – As we are using the free credit from Google Cloud Platform, it is highly recommended to stop & delete the virtual machine when not in use. This is needed to keep our credit available to explore more areas from the Google Cloud Platform.

Login into Virtual Machine in Google Cloud Platform (GCP)

There are a couple of ways to login into the Virtual Machine. I will focus on below two ways.

Open in browser window

We can log in to our virtual machine by clicking on the option “Open in browser window” from the SSH dropdown. It will open the virtual machine console in a new browser as shown below.

View gcloud command

We can log in to our virtual machine through gcloud command. For that, we need to click on the option “view gcloud command” from the SSH dropdown. And then click on Run in Cloud Shell“. It will open the virtual machine in the gcloud console. You might need to approve the authorization.

 

In my next blog, I will share how you can run your first program in Google Cloud Virtual Machine. Till then, stay safe.

1 Comment

  1. נערות ליווי תל אביב

    I would like to thank you for the efforts youve put in writing this blog. Im hoping to view the same high-grade content by you later on as well. In fact, your creative writing abilities has encouraged me to get my own, personal blog now 😉

    Reply

Submit a Comment

Your email address will not be published.