DEMO: SSH to a Linux Instance via Gcloud
Start course
1h 1m

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

The topics covered within this course include:

  • Adding subnets to a VPC
  • Expanding existing subnets
  • Reserving static addresses via the console and Cloud Shell
  • Managing, configuring, and connecting to VM instances
  • Adding GPUs and installing CUDA libraries
  • Creating and deploying from snapshots and images
  • Working with instance groups

Learning Objectives

  • Learn how to manage networking and compute resources on Google Cloud Platform
  • Prepare for the Google Associate Cloud Engineer Exam

Intended Audience

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


To get the most from this course, you should have some exposure to GCP resources, such as VCPs, VM Instances, Cloud Console, and Cloud Shell. However, this is not essential.



Hi, everyone. Now that you know how to connect to Linux VM via SSH through the console, let me quickly show you how to SSH to a Linux instance via GCloud. To connect to a Linux VM through GCloud, launch the Cloud Shell from the upper right-hand corner of your console. Let me go ahead and expand this here. Now, once you have your console opened up here, what I'm going to do here, I'll copy the command into the screen here so you can see what it looks like. What you're going to do is run the GCloud compute command that you see on your screen. When you run this GCloud compute command, what you need to do is specify SSH as your method for connecting, and then what you need to do is use the --project flag and specify the project that holds the VM you're going to connect to.

In this case, I'm using the cloud academy content team project. You'll also need to use the --zone flag to specify the zone that hosts your VM as well. And then lastly, specify the name of the VM that you want to connect to. So, let me go ahead and hit enter here to run this command. Now, when I run this command, I'm prompted for a passphrase for the key that is stored for my instance. If this was my first time connecting, GCP would have created a key pair along with a passphrase that I set to protect my connection. Since I've already connected to this VM previously, I just need to specify the passphrase that I set up earlier when I first connected to it. So, I'll go ahead and enter that in here. And as you can see here, I'm now sitting at a command prompt and can manage my VM like any other Linux machine.

About the Author
Learning Paths

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.