이 문서에서는 SSH 키를 사용하여 외부 IP 주소가 있는 Linux 가상 머신(VM) 인스턴스에 연결하는 방법을 설명합니다. 외부 IP 주소가 없는 VM에 연결하는 방법을 알아보려면 내부 전용 VM의 연결 옵션을 참조하세요.
SSH 인증서를 사용하여 Linux VM에 연결하는 방법을 알아보려면 OS 로그인 VM에 SSH 인증서 필요를 참조하세요.
SSH 키 구성 및 저장을 포함하여 Compute Engine에서 SSH 연결이 작동하는 방식에 대한 자세한 내용은 Linux VM에 대한 SSH 연결을 참조하세요.
시작하기 전에
아직 인증을 설정하지 않았다면 설정합니다.
인증은 Google Cloud 서비스 및 API에 액세스하기 위해 ID를 확인하는 프로세스입니다.
로컬 개발 환경에서 코드 또는 샘플을 실행하려면 다음 옵션 중 하나를 선택하여 Compute Engine에 인증하면 됩니다.
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
After installing the Google Cloud CLI,
initialize it by running the following command:
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
PATH_TO_PRIVATE_KEY: VM에 추가한 공개 키에 해당하는 비공개 SSH 키 파일의 경로입니다.
USERNAME:
사용자 이름. 메타데이터에서 SSH 키를 관리하는 경우, 사용자 이름은 SSH 키를 만들 때 지정한 사용자 이름입니다.
OS 로그인 계정의 경우 사용자 이름이 Google 프로필에 정의되어 있습니다.
예를 들면 cloudysanfrancisco_example_com 또는 cloudysanfrancisco입니다.
Host Name 필드에 SSH 키와 연관된 사용자 이름 및 연결할 VM의 외부 IP 주소를 입력합니다. 다음 형식을 사용합니다.
USERNAME@EXTERNAL_IP
다음을 바꿉니다.
USERNAME:
사용자 이름. 메타데이터에서 SSH 키를 관리하는 경우, 사용자 이름은 SSH 키를 만들 때 지정한 사용자 이름입니다.
OS 로그인 계정의 경우 사용자 이름이 Google 프로필에 정의되어 있습니다.
예를 들면 cloudysanfrancisco_example_com 또는 cloudysanfrancisco입니다.
EXTERNAL_IP: VM의 외부 IP 주소
카테고리 메뉴에서 연결 > SSH > 인증으로 이동합니다.
인증용 비공개 키 파일 필드에서 VM에 추가한 공개 파일에 해당하는 비공개 SSH 키 파일을 선택합니다.
열기를 클릭하여 VM에 연결합니다.
시큐어 셸 Chrome 앱
Secure Shell Chrome 앱에서 SSH를 사용하여 VM에 연결하려면 다음을 수행합니다.
사용자 이름 필드에 사용자 이름을 입력합니다. 메타데이터에서 SSH 키를 관리하는 경우, 사용자 이름은 SSH 키를 만들 때 지정한 비밀번호입니다. OS 로그인 계정의 경우 사용자 이름이 Google 프로필에 정의되어 있습니다.
예를 들면 cloudysanfrancisco_example_com 또는 cloudysanfrancisco입니다.
호스트 이름 필드에 VM의 외부 IP 주소를 입력합니다.
ID 필드에서 가져오기...를 클릭하고 VM에 추가한 공개 키에 해당하는 비공개 SSH 키 파일의 경로를 선택합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-30(UTC)"],[[["\u003cp\u003eThis document guides users on connecting to Linux virtual machine (VM) instances with external IP addresses, detailing how to connect to VMs that do not have external IP's through the provided link.\u003c/p\u003e\n"],["\u003cp\u003eCompute Engine offers various methods to connect to Linux VMs, including using the Google Cloud console, gcloud CLI, OpenSSH client, PuTTY app, and Secure Shell Chrome app.\u003c/p\u003e\n"],["\u003cp\u003eBefore connecting, users should set up authentication and can install the Google Cloud CLI and set a default region and zone.\u003c/p\u003e\n"],["\u003cp\u003eSSH key management is essential for connecting to VMs, with options to create ephemeral or persistent keys, and users can add SSH keys to VMs as needed.\u003c/p\u003e\n"],["\u003cp\u003eSupported operating systems include all public Linux images on Compute Engine, although Fedora CoreOS images require setting up SSH access in advance, and troubleshooting information is provided for failed SSH connections.\u003c/p\u003e\n"]]],[],null,["Linux\n\n*** ** * ** ***\n\nThis document describes how to connect to Linux virtual machine (VM) instances\nthat have external IP addresses by using SSH keys. To learn how to connect to\nVMs that don't have external IP addresses, see\n[Connection options for internal-only VMs](/compute/docs/connect/ssh-internal-ip).\nTo learn how to connect to Linux VMs using SSH certificates, see\n[Require SSH certificates for OS Login VMs](/compute/docs/oslogin/certificates).\n\nFor information about\nhow SSH connections work in Compute Engine, including SSH key configuration\nand storage, see [SSH connections to Linux VMs](/compute/docs/instances/ssh).\n| **Note:** When a user connects to a VM, that user can use all of the IAM permissions granted to the service account attached to the VM.\n\nBefore you begin\n\n- If you haven't already, set up [authentication](/compute/docs/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:\n\n Select the tab for how you plan to use the samples on this page: \n\n Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n gcloud\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\nSupported operating systems\n\nThese connection methods are supported for all\n[public Linux images](/compute/docs/images/os-details) that are available on\nCompute Engine. For Fedora CoreOS images, you must\n[set up SSH access](https://docs.fedoraproject.org/en-US/fedora-coreos/tutorial-containers/)\nbefore you can use these methods.\n\nConnect to VMs\n\nTo connect to a VM, complete the steps in one of the following tabs. \n\nConsole\n\nConnect to VMs using [SSH-in-browser](/compute/docs/ssh-in-browser) from the\nGoogle Cloud console, by doing the following:\n\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. In the list of virtual machine instances, click **SSH** in the row of the instance that you want to connect to.\n\n\u003cbr /\u003e\n\n| **Note:** When you connect to VMs using the Google Cloud console, Compute Engine creates an ephemeral SSH key for you. For more information about SSH keys, see [SSH connections to Linux VMs](/compute/docs/instances/ssh).\n\ngcloud\n\nConnect to a VM using SSH by running the\n[`gcloud compute ssh` command](/sdk/gcloud/reference/compute/ssh):\n\n1. In the Google Cloud console, activate Cloud Shell.\n2. [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n3. At the bottom of the Google Cloud console, a [Cloud Shell](/shell/docs/how-cloud-shell-works) session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.\n4. Run the following command:\n\n ```\n gcloud compute ssh --project=PROJECT_ID --zone=ZONE VM_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project that contains the VM\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the name of the zone that the VM is located in\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM\n\n If you have [set default\n properties](/compute/docs/gcloud-compute#default-properties) for the Google Cloud CLI, you can omit the `--project` and\n `--zone` flags from this command. For example: \n\n ```\n gcloud compute ssh VM_NAME\n ```\n\n| **Note:** When you connect to VMs using the gcloud CLI, Compute Engine creates a persistent SSH key for you. For more information about SSH keys, see [SSH connections to Linux VMs](/compute/docs/instances/ssh).\n\nOpenSSH client\n\nConnect to a VM using SSH from an OpenSSH client, do the following:\n\n1. [Add an SSH key to the VM](/compute/docs/connect/add-ssh-keys) if you haven't already.\n2. In the Google Cloud console, go to the **VM Instances** page and find the\n\n external IP address\n\n of the\n\n VM that you want to connect to.\n\n [Go to VM Instances](https://console.cloud.google.com/compute/instances)\n3. Open a terminal on your workstation.\n4. Connect to the\n\n VM by running the following command:\n\n ```\n ssh -i PATH_TO_PRIVATE_KEY USERNAME@EXTERNAL_IP\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePATH_TO_PRIVATE_KEY\u003c/var\u003e: the path to the private SSH key file that corresponds to the public key you added to the VM.\n - \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e: your username. If you manage your SSH keys in metadata, the username is what you specified when you [created the SSH key](/compute/docs/connect/create-ssh-keys). For OS Login accounts, the username is [defined in your Google profile](/compute/docs/connect/add-ssh-keys#os-login). For example, `cloudysanfrancisco_example_com` or `cloudysanfrancisco`.\n - \u003cvar translate=\"no\"\u003eEXTERNAL_IP\u003c/var\u003e: the external IP address of the VM.\n\nPuTTY app\n\nConnect to a VM using SSH from the Windows PuTTY app, by doing the following:\n\n1. [Add an SSH key](/compute/docs/connect/add-ssh-keys) to the VM if you haven't already.\n2. If your workstation doesn't already have the PuTTY app installed, [download the PuTTY package files](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).\n3. In the Google Cloud console, go to the **VM Instances** page and find the\n\n external IP address\n\n of the VM that you want to connect to.\n\n [Go to VM Instances](https://console.cloud.google.com/compute/instances)\n4. Open the PuTTY app. A connection configuration window opens.\n5. In the `Host Name` field, enter the username associated with the SSH key, and\n the\n\n external IP address\n\n of the VM that you want to connect to. Use the following format:\n\n ```\n USERNAME@EXTERNAL_IP\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e: your username. If you manage your SSH keys in metadata, the username is what you specified when you [created the SSH key](/compute/docs/connect/create-ssh-keys). For OS Login accounts, the username is [defined in your Google profile](/compute/docs/connect/add-ssh-keys#os-login). For example, `cloudysanfrancisco_example_com` or `cloudysanfrancisco`.\n - \u003cvar translate=\"no\"\u003eEXTERNAL_IP\u003c/var\u003e: the external IP address of the VM.\n6. In the **Category** menu, navigate to **Connection \\\u003e\n SSH \\\u003e Auth**.\n7. In the **Private key file for authentication** field, select the private SSH key file that corresponds to the public key you added to the VM.\n8. Click **Open** to connect to the VM.\n\nSecure Shell Chrome app\n\nTo connect to a VM using SSH from the Secure Shell Chrome app, do the\nfollowing:\n\n1. [Add an SSH key to the VM](/compute/docs/connect/add-ssh-keys) if you\n haven't already.\n\n2. Install\n [Secure Shell](https://chrome.google.com/webstore/detail/secure-shell/iodihamcpbpeioajjeobimgagajmlibd)\n on your Chromebook or Chrome browser if you have not done so already.\n\n3. In the Google Cloud console, go to the **VM Instances** page and\n find the external IP address of the VM that you want to connect\n to.\n\n [Go to VM Instances](https://console.cloud.google.com/compute/instances)\n4. Open the Secure Shell in a Chrome browser tab address bar, by doing the\n following:\n\n - Type `ssh`.\n - Press `Space`.\n - Press `Enter`.\n5. Click **\\[New Connection\\]**.\n\n6. In the **username** field, enter your username. If you manage your SSH\n keys in metadata, the username is what you specified when you\n [created the SSH key](/compute/docs/connect/create-ssh-keys). For OS\n Login accounts, the username is\n [defined in your Google profile](/compute/docs/connect/add-ssh-keys#os-login).\n For example, `cloudysanfrancisco_example_com` or `cloudysanfrancisco`.\n\n7. In the **hostname** field, enter the external IP address of the VM.\n\n8. In the **Identity** field, click **Import...** and select the path to\n the private SSH key file that corresponds to the public key you added to\n the VM.\n\n9. Click **\\[ENTER\\] Connect** to connect to the VM.\n\nTroubleshooting\n\nTo find methods for diagnosing and resolving failed SSH connections, see\n[Troubleshooting SSH](/compute/docs/troubleshooting/troubleshooting-ssh).\n\n\nWhat's next\n\n- Learn how to [manage access to VMs](/compute/docs/instances/access-overview).\n- Learn how to [transfer files to VMs](/compute/docs/instances/transfer-files).\n- Learn how [SSH connections to Linux VMs](/compute/docs/instances/ssh) work on Compute Engine."]]