Help Center/ ModelArts/ Troubleshooting/ DevEnviron/ Failures to Access the Development Environment Through VS Code/ What Do I Do If Error Message "ssh: connect to host ModelArts-xxx port xxx: Connection timed out" Is Displayed?
Updated on 2026-09-02 GMT+08:00

What Do I Do If Error Message "ssh: connect to host ModelArts-xxx port xxx: Connection timed out" Is Displayed?

Symptom

When connecting to a notebook instance via SSH, the following error message occurs:

ssh: connect to host ModelArts-xxx port xxx: Connection timed out

Possible Cause

The network connection is unreachable when attempting to access the cloud notebook instance via SSH. In most scenarios, this issue is triggered by the security configurations of your local network environment.

Solution

Perform the following steps to troubleshoot:

  1. Direct SSH troubleshooting
    VS Code's Remote-SSH extension essentially calls your local SSH client.
    1. Open a terminal on the node where VS Code is running (such as PowerShell, CMD, or Git Bash on Windows).
    2. Use SSH to connect to the notebook instance. For details about how to connect to an instance using SSH, see Using a Notebook Instance Remotely with SSH.
  2. Specialized VS Code troubleshooting
    • Connection timeout value is too short
      VS Code's default connection timeout limit might be insufficient, particularly in high-latency network environments.
      1. You can resolve this by editing your SSH configuration file:
        • Linux or macOS: Edit the ~/.ssh/config file.
        • Windows: Edit the C:\Users\<Your_Username>\.ssh\config file.
      2. Add the following configurations for your host:
        Host <Your_Host_Alias>
            HostName <Actual_IP>
            User <Username>
            Port <Port>
            ConnectTimeout 30
            ServerAliveInterval 60
            ServerAliveCountMax 3
      3. Save the file and reconnect to the notebook instance.
    • VS Code freezes when executing remote commands
      Once connected to the notebook instance, VS Code runs a sequence of scripts to perform tasks like installing and starting the VS Code Server. If the notebook instance lacks internet access to download the VS Code Server, or if script execution takes too long, a "timed out" error will trigger. You can resolve this by manually installing the VS Code Server:
      1. Download the matching VS Code Server package onto your local machine.
      2. Disable automatic server downloads in your local VS Code settings by setting Remote.SSH: Allow Local Server Download to false.
      3. Manually install the VS Code Server package inside the notebook instance, then try reconnecting.