Connecting to Instances

Compute Engine provides tools to manage your SSH keys and help you connect to either Linux and Windows Server instances.

This page explains the most basic ways to connect to your Compute Engine instances. Alternatively, you can learn how to connect to instances using third-party tools or connect to instances that have no external IP addresses.

To learn how to use IAM roles to manage user access to your Linux instances, see Managing Instance Access using OS Login.

Connecting to Linux instances

You can connect to Linux instances through either the Google Cloud Platform Console or the gcloud command-line tool. Compute Engine generates an SSH key for you and stores it in one of the following locations:

  • By default, Compute Engine adds the generated key to project or instance metadata.
  • If your account is configured to use OS Login, Compute Engine stores the generated key with your user account.

Console

  1. In the Cloud Platform Console, go to the VM Instances page.

    Go to the VM Instances page

  2. In the list of virtual machine instances, click SSH in the row of the instance that you want to connect to.

gcloud

Use the gcloud compute ssh command to connect to instances that you have permission to access:

gcloud compute ssh [INSTANCE_NAME]

where [INSTANCE_NAME] is the name of the instance.

After you connect, you can use the terminal to run commands on your Linux instance. When you are done, use the exit command to disconnect from the instance.

Connecting to Windows instances

You can use RDP to connect to a Windows instance and start a remote desktop session. This process allows you to interact with the Windows desktop remotely.

If you run into issues logging in to your instance using RDP, you might not have a firewall rule that allows RDP traffic on port 3389 (tcp:3389). For instructions on how to add a firewall rule, see Adding a firewall rule.

Console

  1. Go to the VM instances page in the in the GCP Console.

    Go to the VM instances page

  2. Click the RDP button next to the instance that you want to connect to. A new browser window opens with the Chrome RDP for Google Compute Engine Icon for RDP extension extension.
  3. Enter your username and password. If this is your first time connecting to this instance, or if you have forgotten your password, read the documentation for Creating passwords for Windows instances.
  4. Click OK to connect.

Connect through an RDP client

  1. Install an RDP client. If you don't have a preference, install the Chrome RDP for Google Compute Engine Icon for RDP extension extension.
  2. Find the external IP for your Windows instance. Go to the VM instances page in the GCP Console or run gcloud compute instances list to see a list of your instances with their External IP values.
  3. In your RDP client, specify the external IP address for your instance as the IP address to connect to. For example, in the Chrome RDP extension, you would enter the IP address in the following format: Screenshot of the instance creation window with the required options set
  4. Enter your log-in information and leave the Domain field blank. If this is your first time connecting to this instance, or if you have forgotten your password, read the documentation for Creating passwords for Windows instances.

    Screenshot of the instance creation window with the required options set

What's next

Send feedback about...

Compute Engine Documentation