Connecting to the Virtual Machine with a Browser-Based SSH Connection
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.
1. Navigate to the Compute Engine by clicking the top-left accordion icon to open the navigation menu followed by Compute Engine:
You are taken to the VM instances table and the ca-lab-vm instance created by the Cloud Academy Lab environment is listed:
2. Click the down arrow in the Connect section and click on Open in browser window:
Alternatively, you can directly click SSH.
A new browser window opens and the progress is reported:
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:
You are now connected to the virtual machine from your browser!
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.