1. Home
  2. Training Library
  3. Google Cloud Platform
  4. Courses
  5. Deploying Networking and Compute Resources on Google Cloud Platform

DEMO: Generating and Uploading a Custom SSH Key for Instances

play-arrow
Start course
Overview
DifficultyBeginner
Duration1h 18m
Students91
Ratings
5/5
star star star star star

Description

This course has been designed to teach you how to deploy network and compute resources on Google Cloud Platform. The content in this course will help prepare you for the Associate Cloud Engineer exam.

Learning Objectives

  • To understand key networking and compute resources on Google Cloud Platform
  • Be able to explain different networking and compute features commonly used on GCP
  • Be able to deploy key networking and compute resources on Google Cloud Platform

Intended Audience

  • Those who are preparing for the Associate Cloud Engineer exam
  • Those looking to learn more about GCP networking and compute features

Prerequisites

To get the most from this course then you should have some exposure to GCP resources, such as VPCs and Compute Instances. However, this is not essential.

Transcript

When connecting to a Linux VM instance, you'll sometimes need or want to connect, using a custom SSH key. To connect to a GCP compute instance using a custom SSH key, you first need to generate the keypair. This keypair includes the public key that gets added to the compute instance as well as the private key that you use to connect with. What we're going to do here in this lesson is walk through the process of creating a custom SSH key that we're going to use to connect to an existing Linux VM that I've deployed. 

Now, since windows doesn't offer a built-in tool for generating SSH keys, I'm going to use the PuTTYgen tool to create my keypair. On the screen, here, you can see that we're going to be working with VM2, which is actually a Linux VM. To create a custom SSH key for this VM, let's drag my PuttyGen console over from the other screen. 

To create a keypair, I just need to click generate here and then follow the instructions for moving my mouse around. Now, I do have to make sure that the key I'm generating is at least 2,048 bits. When I'm done here, my pubic key is shown at the top here. 

Now, at this point, I can save my private key and my public key. Now, in the key comment section, what I need to do is replace this existing text with the username for whom the key is going to apply. So I'll call this vmadmin. I can also provide a passphrase to protect my key if I wanted to. But I'm going to skip that for this exercise. So let me save my private key. And then I'll save my public key. 

Now after I've saved my keys, what I want to do is copy the public key from the top of the PuttyGen window, because I'm going to add this to my VM instance. With my pubic and private keys saved, and my pubic key value copied to my clipboard, I can switch back over to my VM here and I can click Edit. If I scroll down to SSH Keys, I can see that I have no SSH keys assigned yet. I'm going to change this by clicking Show and Edit. At this point, I need to paste my public key value into the box here, and then click Save down at the bottom. What this does is store the public key with the VM instance. Before I navigate away from my VM instance, I need to copy the external IP of it, so I can try to connect to it. 

With the public key stored and the external IP copied, let's drag my Putty utility over and try to connect. To connect, what I need to do is copy the external IP address of my instance into the hostname field here. I also need to ensure that SSH is selected here. Now, before I connect, what I need to do is expand SSH down here on the left side and select the Auth option. From here, I can browse to my private key that I'm going to use to authenticate. 

At the prompt here, I need to provide the username that I entered in the key comment section when I created the key. If everything works like it's supposed to, I'm granted access to the VM, like you see here. So that is how you create a key or really a keypair, how you upload the public key to your instance and how you use the private key to connect to that instance using a third-party utility.

About the Author

Students5101
Courses20
Learning paths3

Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.

In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.

In his spare time, Tom enjoys camping, fishing, and playing poker.

Covered Topics