Connecting to VM Instance

Introduction to SSH clients, RDP client and firewall

Connecting to instance

In this lesson, we will learn how to connect to the Linux instance as well as to a Windows instance.

Linux

To connect to the Linux instance, we use SSH. This is the simplest method to connect to a Linux instance. Google Cloud provides in-browser SSH support. Click on the SSH button next to the instance.

The instance name can different for you.

Using SSH CLI clients

You can also use gcloud ssh client to ssh into the instance. To use the gcloud ssh client, open the terminal and follow the steps.

  • Set the right project to use. Type gcloud config set project [project ID].

  • Type gcloud compute ssh --zone us-central1-a [username]@[instance_name/host_name].

For example, if the instance name is “demo-instance” and the user is “demo” then you will write:

$ gcloud compute ssh --zone us-central1-a demo@demo-instance

Hit enter for a blank passphrase while creating ssh keys.

This command will add your local ssh keys to the project-wide metadata section. And then you can use the same ssh keys to SSH into other VM instances.

To check the project-wide ssh keys,

Go to the settings section of Compute Engine > Metadata and then select the SSH keys. This section will list all the ssh keys added for this project.

Get hands-on with 1200+ tech skills courses.