[[["わかりやすい","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-09-04 UTC。"],[],[],null,["# Use SSH to access JupyterLab\n============================\n\n\n| Vertex AI Workbench user-managed notebooks is\n| [deprecated](/vertex-ai/docs/deprecations). On\n| April 14, 2025, support for\n| user-managed notebooks will end and the ability to create user-managed notebooks instances\n| will be removed. Existing instances will continue to function\n| but patches, updates, and upgrades won't be available. To continue using\n| Vertex AI Workbench, we recommend that you\n| [migrate\n| your user-managed notebooks instances to Vertex AI Workbench instances](/vertex-ai/docs/workbench/user-managed/migrate-to-instances).\n\n\u003cbr /\u003e\n\nWhenever you don't have HTTPS access to your JupyterLab instance,\nyou must use SSH to establish a connection.\n\nTo set up\n[SSH port forwarding](/solutions/connecting-securely#port-forwarding-over-ssh),\ncomplete the following steps, and then access your JupyterLab session through a\nlocal browser:\n\n1. Run the following command by using the [Google Cloud CLI](/sdk/gcloud) in\n your preferred terminal or in\n [Cloud Shell](https://console.cloud.google.com?cloudshell=true):\n\n ```bash\n gcloud compute ssh \\\n --project PROJECT_ID \\\n --zone ZONE \\\n INSTANCE_NAME \\\n -- -L 8080:localhost:8080\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: your [Google Cloud project ID](/resource-manager/docs/creating-managing-projects#identifying_projects)\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the [zone](/compute/docs/regions-zones) where your instance is located\n - \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e: the name of your instance\n\n| **Note:** If using Cloud Shell to run the command, add a `-4` to the SSH flags to use IPv4 to connect. Example: `-- -4 -L `\u003cvar translate=\"no\"\u003eLOCAL_PORT\u003c/var\u003e`:localhost:`\u003cvar translate=\"no\"\u003eREMOTE_PORT\u003c/var\u003e\n\n1. Access your JupyterLab session through a local browser:\n\n - If you ran the command on your local machine, visit\n `https://localhost:8080` to access JupyterLab.\n\n - If you ran the command using\n [Cloud Shell](https://console.cloud.google.com?cloudshell=true),\n access JupyterLab through the\n Web\n Preview on port 8080.\n\nReasons why you might not have HTTPS access\n-------------------------------------------\n\nTo get HTTPS access to JupyterLab, your user-managed notebooks\ninstance must have access to a Google Cloud proxy service.\nWhen the instance starts, it attempts to register itself with\nthe proxy service. If it fails to get proxy access,\nyour user-managed notebooks instance\nprompts you to access JupyterLab through SSH.\n\nThe following are common reasons why you might not have HTTPS access to\nJupyterLab:\n\n- Your JupyterLab instance's proxy-mode metadata setting\n is incorrect.\n\n- Your network is configured to block internet access for the\n virtual machines (VMs) running JupyterLab notebooks.\n\n- Your user-managed notebooks instance\n doesn't have an external IP address.\n\n- Your [VPC Service Controls](/vpc-service-controls/docs/overview) settings\n block access to [Artifact Registry](/container-registry/docs).\n\nThe following sections show how to resolve these issues.\n\nFor changes to take effect, you might need to restart the notebook's VM when\nattempting to resolve these issues.\n\nYour JupyterLab instance's proxy-mode metadata setting is incorrect\n-------------------------------------------------------------------\n\nBy default, when you use user-managed notebooks to create\na JupyterLab instance, Vertex AI Workbench adds\nthe proxy-mode metadata setting.\nIf you change or remove the proxy-mode metadata setting, then\nthe user-managed notebooks instance\ncan't connect to the proxy service.\n\nTo make sure your proxy-mode metadata setting is valid, complete\nthe following steps:\n\n1. In the Google Cloud console, go to the **User-managed notebooks** page.\n\n [Go to User-managed notebooks](https://console.cloud.google.com/vertex-ai/workbench/user-managed)\n2. Select the instance that you need to modify.\n\n3. Next to **View VM details** , click **View in Compute Engine**.\n\n4. On the VM details page, click **Edit**.\n\n5. In the **Metadata** section, add or modify\n the metadata to ensure there is a `proxy-mode entry``set\n to the correct value, for example:`project_editors\\`.\n\n [Learn more about the possible values of the `proxy-mode` metadata\n entry](/vertex-ai/docs/general/troubleshooting-workbench#opening_a_notebook_results_in_a_403_forbidden_error).\n6. Click **Save**.\n\nThe network is blocking internet access\n---------------------------------------\n\nYour JupyterLab instance accesses the proxy service through a public URL.\nIf your Virtual Private Cloud network settings block access to the public internet\nor your firewall rules block egress traffic, you must use SSH to access\nyour user-managed notebooks instance.\nIf possible, you might want to work\nwith your network and firewall administrators to allow access to your\nuser-managed notebooks instance through the public internet.\n\nYour user-managed notebooks instance doesn't have an external IP address\n------------------------------------------------------------------------\n\nYou might have created your user-managed notebooks instance\nwithout an\nexternal IP address. If you need to change this, complete the following\nsteps.\n\n1. In the Google Cloud console, go to the **User-managed notebooks** page.\n\n [Go to User-managed notebooks](https://console.cloud.google.com/vertex-ai/workbench/user-managed)\n2. Click the name of the instance that you need to modify.\n\n3. Click **View VM details**.\n\n4. Click **Edit**.\n\n5. In the **Network interfaces** section, expand the network that\n you want to have an external IP address.\n\n6. Click the **External IP address** drop-down menu,\n and select the option that you want.\n To resolve this issue, you must not choose **None**.\n\n7. In the **Network interfaces** section, click **Done**.\n\n8. Click **Save**.\n\nVPC Service Controls settings are blocking access to Artifact Registry\n----------------------------------------------------------------------\n\nTo connect to the proxy service,\nyour user-managed notebooks instance runs an\nagent that it downloads from Artifact Registry. Without this agent\nyour instance cannot connect to the proxy service.\n\nIf your VPC Service Controls settings are blocking access to\nArtifact Registry, you must add the Artifact Registry\nservice to the service perimeter of your VPC Service Controls.\n[Learn more about how service perimeters\nwork and what services VPC Service Controls can be used\nto secure](/vpc-service-controls/docs/overview#capabilities).\n\nFurther troubleshooting\n-----------------------\n\nIf you are still having trouble connecting, try reviewing the console\nlogs for your virtual machine. These logs might help you discover why\nthe user-managed notebooks instance is unable\nto register with the proxy service.\n\nTo access these logs, complete the following steps:\n\n1. In the Google Cloud console, go to the **User-managed notebooks** page.\n\n [Go to User-managed notebooks](https://console.cloud.google.com/vertex-ai/workbench/user-managed)\n2. Select the instance that you want to troubleshoot.\n\n3. In **Logs** , click **Serial port 1 (console)**.\n\nWhat's next\n-----------\n\nFor tips on resolving other issues,\nsee the [troubleshooting section on user-managed\nnotebooks](/vertex-ai/docs/general/troubleshooting-workbench#user-managed-notebooks)."]]