Sitemap

In conversation with GCP | Part-1

10 min readMar 20, 2022

--

Press enter or click to view image in full size

In this blog, we shall be looking at following concepts :-

  • Introduction to Regions in GCP.
  • Introduction to Zones in GCP.
  • Increasing Fault Tolerance within same region.
  • Increasing Availability across the regions.
  • GCP resources & Interfaces.
  • Setting up Compute Engine (VM Instance) @ GCP.
  • Difference between External & Internal IP Address.
  • Associating Static External IP Address.
  • StartUp-Script to specify softwares at launch of Instance.
  • Generating Instance Template.
  • Launching VM instances using Custom-Image

Question:- What is a Region in GCP ?

Answer:- Regions are independent geographic area that consist of zones. And this is like you can think of it’s a partition independent area.

Press enter or click to view image in full size

The main purpose is to host application near to your users reduce latency unavailability and durability.

Question:- What are Zones in GCP ?

Answer:- Zones are the actual physical locations inside the Regions.

Press enter or click to view image in full size

Question:- How many Regions and Zones are there as of now ?

Answer:- There are 20 regions which are out there right now 61 zones. These are the 61 physical location. That’s where I have data centers. You can think of as an actual data-center. It is available in 200 plus countries.

Press enter or click to view image in full size

Question:- What are the challenges associated with single data centre in one Region ?

Press enter or click to view image in full size

Question:- How do we address the problem of a Data Centre crash in above scenario ?

Answer:- Solution is to add the another data centre in same region.

Press enter or click to view image in full size

Question:- How do we address the problem of Crash of full region t

Answer:- Solution is to have multiple regions and each region would have multiple data centres in it.

Press enter or click to view image in full size

Question:- What’s the advantage of procuring services from Goggle in above situations ?

Press enter or click to view image in full size

Question:- How do we achieve Increased availability within same region ?

Press enter or click to view image in full size

Question:- List down some examples of Regions & their respective zones in GCP ?

Press enter or click to view image in full size

Question:- Which all services are provided by GCP ?

Answer:- There are plenty of services being provided by GCP :-

Press enter or click to view image in full size

Following are the services chart available from GCP side :-

Press enter or click to view image in full size

Following are the Management related tools available from GCP side :-

Press enter or click to view image in full size

Question:- What all Interfaces are possible in GCP ?

Answer:- Following are various interfaces available in GCP :-

Press enter or click to view image in full size

Here is how the CLI looks like. These days, there are options for GCP shell as well :-

Press enter or click to view image in full size

Question:- What is the Project in GCP ?

Answer:- Project is container in JCP. If we created this account there is a default project which is created for you.

Press enter or click to view image in full size

Shutting down the project means it is going to decommission all your cloud resources in your project :-

Press enter or click to view image in full size

NOTE:- The charging happens at the Project level.

Question:- What are the GCP Resources ?

Answer:- Anything which is you can think of. For example :-

  • If you go ahead and create virtual machine.
  • If you go ahead and create App Engine instance.
  • If you create a SQL database.
  • If you create a network.
  • If you want to create a firewall rules.

Question:- What are the various types of GCP Resources ?

Answer:- There are three types of resources :-

Press enter or click to view image in full size

Below is how the resources are organised usually :-

Press enter or click to view image in full size

Question:- What is a Quota in GCP ?

Press enter or click to view image in full size

Question:- What are the benefits of Quota in GCP ?

Press enter or click to view image in full size

Question:- On which basis, does Project Quotas and Limits works in GCP ?

Press enter or click to view image in full size

Question:- How and where do we access Infrastructure in Google’s parlance ?

Press enter or click to view image in full size

Question:- What are the features of the Google Compute Engine ?

Press enter or click to view image in full size

Question:- Which are the various families available for the Google Compute Engine ?

Press enter or click to view image in full size

Question:- Which are the various variants available under E2 family of VM ?

Press enter or click to view image in full size

Question:- How do we know the RAM & CPU available with eachVM type ?

Press enter or click to view image in full size

Question:- Which OS do we install at our VM ?

Press enter or click to view image in full size

Question:- Demonstrate an example for launching a simple Compute-Engine in GCP ?

Step #1.) Go to VM Instances :-

Press enter or click to view image in full size

Step #2.) Specify the name of the Instance, allocate some labels to it and choose from region & zone :-

Press enter or click to view image in full size

Step #3.) Choose the family type with which instance to work :-

Press enter or click to view image in full size

Step #4.) Select the HDD to be attached with the VM instance :-

Press enter or click to view image in full size

Step #5.) Let’s now choose the operating-System to install on our Compute-Engine instance :-

Press enter or click to view image in full size

Step #6.) Last but not least, we select the Firewall rules :-

Press enter or click to view image in full size

Step #7.) Finally, we have the instance launched here :-

Press enter or click to view image in full size

Question:- Demonstrate the setting up of an Apache Web Server on the afore-launched Google Compute Engine VM Instance ?

* sudo su
* apt update
*
apt install apache2
* echo "Hello world from $(hostname) $(hostname -i)" > /var/www/html/index.html
* sudo service apache2 start

Question:- What’s the concept of the External & Internal IP Address ?

Press enter or click to view image in full size

Question:- Now so, we know that each time our VM instance is restarted, External IP Address changes, how do we solve this problem ?

Answer:- The solution is to use Static External IP Address. Here are steps to create the same :-

Step #1.) Let’s search into our console : “External IP Addresses”.

Press enter or click to view image in full size

Step #2.) Let’s now click on “Reserve Static Address” and work with the same :-

Press enter or click to view image in full size

Step #3.) Let’s create a static address :-

Press enter or click to view image in full size

Step #4.) Next, we click on button “CHANGE”. Note in the below snapshot that, there is a new row for external ip-address has been created well :-

Press enter or click to view image in full size

Step #5.) Now, allocate this ip-address to our compute-engine instance :-

Press enter or click to view image in full size

Step #6.) Here is our compute-engine instance has been binded with External IP Address :-

Press enter or click to view image in full size

Question:- What are the other important features of the “Static IP Address” ?

Press enter or click to view image in full size

Question:- How do we release the “Static IP Address” ?

Press enter or click to view image in full size

Question:- How do we reduce the number of steps, while creating VM instance ?

Press enter or click to view image in full size

Concept #1.) :- Demonstrate the process of setting up an HttpServer using the Startup-script ?

Press enter or click to view image in full size

Step #1.) Let’s create a new VM compute-engine instance :-

Press enter or click to view image in full size

Step #2.) Next step is to create the management :-

Press enter or click to view image in full size

Step #3.) Following is the startUp-script, that we can specify at the time of the boot up. This is also called as StartUp Script.

Press enter or click to view image in full size

Now, using StartUp Script, we have reduced the time that we would perhaps had to invest post boot-up. Also, we can install OS patches and software @ the time of VM launch itself.

Concept #2.) :- What is an “Instance Template” and why do we need it ?

Answer:- Basically, while launching the VM instance, we need to mandatorily specify the hardware-details, VM instance details like Instance-Type, etc. and then specify the startup-scripts. This is a very time-consuming process. We can avoid all of them by specifying instance-template.

Press enter or click to view image in full size

Question:- Demonstrate the step by step process of creating a “Instance Template” and launching the VM from this template ?

Step #1.) In the GCP console, click inside the “Instance Template” :-

Press enter or click to view image in full size

Step #2.) While creating the “Instance Template”, we can specify the machine type and family of compute-engine :-

Press enter or click to view image in full size

Step #3.) Next, we can also specify the disk capacity along with the OS that we would want :-

Press enter or click to view image in full size

Step #4.) Next, we allow the Incoming traffic from Internet over Http and therefore, we select the option #1 below :-

Press enter or click to view image in full size

Step #5.) Next, we specify the startUp-script which here shall be used as automation-script :-

Press enter or click to view image in full size

Step #6.) Finally, we have the Instance-Template created with us. Next, we click on the “Create VM” from it :-

Press enter or click to view image in full size

Step #7.) At the end, we have our VM instance created from this template :-

Press enter or click to view image in full size

Question:- What’s the problem with launching VM instances using this VM Template ? How same can be solved ?

Answer:- Yes, this process increases boot-up time for our compute-engine-instances. This is something, which we shall definitely like to avoid in the production auto scaling scenarios. This problem can be solved by using Custom-Image, to launch VM instances.

Press enter or click to view image in full size

Concept #3.) :- Demonstrate the process of creating the Custom-Image and launching VM instance from that Custom-Image ?

Answer:- The Custom-Image can be created using the HDD (Disk) of any running VM instance. So, It’s necessary to have at-least full-fledged running VM instance, with the help of which we can create custom-image.

Step #1.) Let’s goto the disk of our own VM instance, that we launched above :-

Press enter or click to view image in full size

Step #2.) Now, select the image-name and below details :-

Press enter or click to view image in full size

Step #3.) Hit on the click button :-

Press enter or click to view image in full size

Step #4.) Here are our images we have finally :-

Press enter or click to view image in full size

Step #5.) Now, we can create VM instances using the template that we created above :-

Press enter or click to view image in full size

Step #6.) Next we select the image using which instance has to be launched :-

Press enter or click to view image in full size

Step #7.) Finally, we have the VM instance with us :-

Press enter or click to view image in full size

That’s all in this section. If you liked reading this blog, kindly do press on clap button multiple times, to indicate your appreciation. We would see you in next series.

--

--

aditya goel
aditya goel

Written by aditya goel

Software Engineer for Big Data distributed systems