This document describes how to connect to Linux virtual machine (VM) instances that have external IP addresses by using SSH keys. To learn how to connect to VMs that don't have external IP addresses, see Connection options for internal-only VMs. To learn how to connect to Linux VMs using SSH certificates, see Require SSH certificates for OS Login VMs.
For information about how SSH connections work in Compute Engine, including SSH key configuration and storage, see SSH connections to Linux VMs.
Before you begin
-
If you haven't already, set up authentication.
Authentication verifies your identity for access to Google Cloud services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud initIf you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Set a default region and zone.
-
Supported operating systems
These connection methods are supported for all public Linux images that are available on Compute Engine. For Fedora CoreOS images, you must set up SSH access before you can use these methods.
Connect to VMs
To connect to a VM, complete the steps in one of the following tabs.
