Linux and OS – How to make a new GCP instance and SSH into it .

Now let us start with the “What”, “Why”, and “How”. (I know that’s a lot of questions, but this way, it’ll be easier for us to compartmentalize sections of the title such that we understand with complete clarity about what we are trying to do here.

“What” is GCP, instance and ssh ?
  • GCP or the “Google Could Platform” is a cloud computing platform which provides a plethora of services pertaining to cloud computing. Cloud Computing is basically getting the services you desire on your computer via cloud. Now this is a very simple definition, and it by no means is everything to know about cloud computing. But Cloud computing is beast of a topic, and we will leave it for some other day. For now, all we need to understand is that GCP just like AWS, DigitalOcean and other cloud computing platforms is what we are going to use to create a linux instance. Learn more about cloud computing using GCP here.
  • An “instance” or a “cloud instance” refers to a virtual server/machine which runs our application(s)(workload) on the cloud. We will use GCP to make a linux instance which will be the linux machine that we will be using for learning linux. Learn more about “instances in cloud computing” here.
  • “SSH” also known as “Secure Shell”, is a network protocol which gives users/system admins, a secure way to access a computer over unsecured network. We will be using ssh to securely log into our GCP “instance”. Learn more about SSH here.
  • In my opinion, Google Cloud Platform is really user-friendly. It is one of the best options for beginners to get started with. Since, my assumption for this article is that it is mostly going to read by beginners and first timers in cloud computing, I will be using GCP. But the main idea here is to learn how to make instances and how to ssh into it, so feel free to use whatever platform that is comfortable for you. I will be doing the AWS Cloud Certification soon, and more details about cloud computing and using AWS will be explained then. So do keep a lookout for that. For now, let us proceed with GCP.
“HOW” DO WE Make a GCP instance and ssh into it?

Okay!!! Finally we can get to some hands-on stuff. Let’s get right to it.

  • Step 1: Create and account (If you don’t have one) and log into GCP and navigate to the top left corner and click on “Console”.
  • Step 2: On the left part of the screen, in the menu, hover over “Compute Engine”, and select “VM Instances”
  • Step 3: Select a project you want to work with. If you don’t have one, then type the name of a new project and click on “Create”.
  • Step 4: Set up the billing for your account. (Don’t worry you wont be charged as you can select the free trial). So fill out the details required and finish step 1 and 2 of this billing set up.
  • Step 5: Once you start your free trial, you will be then redirected to the “VM Instances: page. It will take a few minutes to load all your settings. As soon as the loading is done, click on “Create”.
  • Step 6: Navigate to “Machine Type” in “machine Configuration” and select “f1-Micro”. The reason why we do this is because, we do not need anything fancy for learning linux. We just need the most basic configuration.
  • Step 7: Make sure that you have selected some version of “Debian” or “Ubuntu” distribution of Linux in the “Boot Disk” section. After doing this, click on “Create” button to create your instance.
  • Step 8: It will take a few minutes to set up the instance. Once its done setting up the instance , you will see the instance on your screen. You will see something like this:
  • Step 9: Open your terminal and type the following command:
    ssh-keygen -t rsa -f ~/Desktop/key_name -C user_name
    • In the above command replace “key_name” with the name you want for your ssh key. You will also replace “user_name” with the username you want for this specific ssh key. You can also replace “~/Desktop/” with whatever directory path you want to store your key in.
    • Once you execute this command, it will ask you to type a passphrase which will be a unique identifier/password for your instance. Make sure that you will remember this passphrase as it will prompt you to enter this passphrase every time you try to log in to your instance using ssh on your system.
    • This command will make two keys, one public and one private. So as soon as you execute this command, two files will be created in the specified directory.
      • The two files will be:
        • key_name
    • So as mentioned before, the “” file is what contains the public ssh key which goes into your GCP instance. “key_name” remains on your machine. The public key is how the instance checks/communicates with the private key on your machine.
  • Step 10: So once you have these two files, open “”, and copy all the contents of the file.
  • Step 11: Open the “VM Instances” page and click on your instance name.
  • Step 12: Click on the “Edit” button, on the top.
  • Step 13: Navigate all the way down to “SSH Keys”. It will say “you have 0 SSH keys.” if this is the first time you are adding an ssh key. Clicl on “Show and Edit” and add/paste your public key that you copied in Step 10.
  • Step 14: Click on the “Save” Button at the bottom of the page. It will take a few seconds to update.
  • Step 15: Copy the external IP from the “VM Instance page.”
  • Step 15: Now open your terminal and type the following command:
    ssh -i ~/Desktop/key_name user_name@external_IP
    • If you stored your key in a different directory then remember to replace “~/Desktop” , with the path of the directory you stored your key in. Also remember to replace “key_name” with the name you saved your key. Similarly, replace user_name with the username corresponding to your instance and external_IP with what you copied in Step 15.
  • Step 16: Once you do all that correctly and execute the command, it will prompt you to type your passphrase. Type your passphrase that you saved in Step 9.
  • Step 17: Now you have successfully logged into your linux instance.

You have now ready to dive right into Linux. Hopefully this article was useful. I will post some other useful articles and links regarding GCP and SSH soon. Will see you in our next post, as we dive straight into “Introduction of Operating Systems.”