Connecting to the Virtual Machine with a Browser-Based SSH Connection

Lab Steps

lock
Signing In to the Google Cloud Console
lock
Connecting to the Virtual Machine with a Browser-Based SSH Connection
lock
Starting a Google Cloud Shell
lock
Generating SSH Keys for the Virtual Machine
lock
Attaching the Public Key to the VM Instance
lock
Connecting to the VM Instance Using the Custom SSH Key
live-help Need help? Contact our support team

Here you can find the instructions for this specific Lab Step.

If you are ready for a real environment experience please start the Lab. Keep in mind that you'll need to start from the first step.

Introduction

Secure shell (SSH) is the standard way to securely connect to Linux instances. Although SSH supports using passwords as credentials, it is more secure to use keys which are long, random sequences of bits (zeros and ones). In Google Compute Engine, you have a few choices for establishing a secure connection using keys. The first is directly from the Cloud Console in a web browser. This provides great convenience since the keys are managed for you. To use SSH from the Browser, the user must be a part of the project containing the instance and have the required Identity and Access Management (IAM) permissions for accessing the instance.

In this lab step, you will establish an SSH connection to the instance using SSH from the Browser.

 

Instructions

1. Navigate to the Compute Engine by clicking the top-left accordion icon to open the navigation menu followed by Compute Engine:

alt

You are taken to the VM instances table and the ca-lab-vm instance created by the Cloud Academy Lab environment is listed:

alt

 

2. Click the down arrow in the Connect section and click on Open in browser window:

alt

Alternatively, you can directly click SSH.

A new browser window opens and the progress is reported:

alt

GCP automatically creates SSH keys for you and transfers them to the VM. The keys also automatically expire after several hours.

 

3. In under a minute, you will see the terminal screen:

alt

You are now connected to the virtual machine from your browser!

 

Summary

In this lab step, you have established an SSH connection to the virtual machine in your Google Cloud environment. Connecting via the browser is one of the most convenient methods for connecting in GCE. However, you need to be a member of the Google Cloud project the instance is in, and have appropriate permissions granted. It is not suitable for third-party tools or scenarios requiring automation.

In the next steps, you will generate custom SSH keys and connect to the VM by using them. This method is compatible with third-party tools and is a more traditional way of connecting to Linux instances.