In this article, we will create a small GCP compute using the GCP console. As you know, we need this machine to install a terraform inside this machine. I will install Nginx to show you as an example. Later in the next articles, I will continue Terraform. For this, the first step is to write this https://cloud.google.com/ URL inside your browser. This screen will come, as shown below. I am already registered with GCP. That’s why the console button is showing up right corner. If you do not have a GCP account, then create it and if already have it, then click console as shown below.
After login, you will see this GCP home screen for the first-time. It will look like this, as shown below.
My first task is to create a project with the name ‘Paayi-tech-learning’ then will make everything in it. You can create up to 10 projects without asking for approvals from Google. But if you need more than ten projects, then you need to request Google. Click on this dropdown, as shown in the image below, to create a new project.
A popup will open, from where you will click New Project to create a new project as shown Image below.
It will take to you to this new page. Over here, give a proper name and click create as shown below.
This new project, ‘Paayi-tech-learning’ will look like this. Select your newly created project and click Open.
Click on the project where you want to create your terraform environment. The new Project environment will look like this.
Let’s work on creating a Google compute now. Click the burger bar on the left side top and search ‘Compute Engine.’ In the compute engine, click ‘VM Instances.’
After clicking the VM instance tab, you will reach the VM instance dashboard. Check for the create button and click it as shown in the image below.
Now you will reach a place where you will see the form where you need to fill the proper specifications for your instance machine. Here you will pick the name of your machine, labels for your machine, how much power you want in your machine, and at last, you want the machine to the outside world or not by selecting HTTP or HTTPS. Check the images below. We filled all the info that we need for this machine.
The first step is to fill the machine name. As we need this machine to install terraform, that’s, we named it Terraform.
The second step is to give labels to the machine. Labels are important if you have multiple machine engines, and you can define machine names by saying it is a production machine or development machine, or testing machine. We need this for CICD, so we named it to terraform.
The third step is to select the Region and the zone; Region is a specific geographical location where you want your machine is to be. One Region can have many availability zones.
Availability Zones are isolated buildings or data centers in a particular region. For example, we selected the us-central1(Iowa) region, and it has 4 zones or availability zones. In us-central1(Iowa) we selected us-central1-a. You can use or select only those resources which are available in that particular zone.
Please select what kind of machine you want. Generally, there are three kinds of machines you can choose from.
General-Purpose: Machine which is used for general workloads, cost-efficient, and flexible.
Memory-Optimized: Machines which has large memories and organizations use them for memory-intensive workloads.
Compute-Optimized: Machines which has large computes, and organizations use them for compute-intensive workloads.
As we need it for general purposes, so we selected a small general-purpose machine with 1 shared core and 1GB memory.
Before clicking the create button, one last step is to check whether you want this machine open to the public or not. We need it to open to HTTP and HTTPS; that’s why we checked both, as shown Image below.
Click create to make your first Google Compute Engine.
In a few mins, you will see a green tick in front of your machine, which means the machine is ready, and now you can work on it.
The machine is ready, and we are going to SSH into it. On the right side, you will see the SSH button and dropdown. Click on the dropdown SSH and click Open in the browser window.
After login into the machine first step is to update all the packages. Please use this command if you have Debian.
Now You will see tow different commands running in the same image, first one is to update the necessary packages of Debian and, the second one is to install Nginx.
Update the Debian repository information:
$ sudo apt-get update
Install the NGINX Open Source package:
$ sudo apt-get install Nginx
Verify the installation:
$ sudo nginx -v
Nginx version: nginx/1.10.3
You can verify by copy-paste the IP into the browser and see if it shows Nginx. As you know we opened this machine for HTTP and HTTPS.
Paste it into the browser.
In the coming topics, I will focus on GCP Compute Engine other tabs like Instance Groups, Instance templates, Sole-tenant nodes, Machine Image, Disks, Snapshots, Images, TPU’s, Migrate for compute engine, etc.
We created this machine to install terraform in it. That’s why in the next topic I will show you how to install and run terraform in it.