SSH access provides alternatives to Jupyterlab for working with your projects. In order to access a server via SSH, a public key must first be added for your user.
Additional Infrastructure Costs
Enabling SSH access for a Jupyter Server can result in additional infrastructure costs.
On AWS, this access requires the provisioning of an Elastic Load Balancer, which incurs costs while running. This load balancer is removed when the server is stopped (either manually or via auto-shutoff), and AWS costs are prorated based on usage. For full-time usage, expect a charge of $20-$30 per month per server with SSH enabled.
Adding SSH Public Keys
From the dashboard sidebar, select "Credentials", then click the
+ in the upper right to add a new credential. Select "SSH Public Key" from the type list, choose a name, and paste in an openssh-formatted public key. If you do not yet have a public key, follow the instructions here to create a keypair, and copy the public key into the text box, as shown below.
Note that some key generation tools (such as PuTTY) may generate public keys in various formats - the public key here must be in openssh format, like in the screenshot above.
Enable SSH for the Jupyter Server
If the server already exists, click its name from the server list to edit its details (if it is running, it must first be stopped). Under Advanced Settings, check the checkbox labeled "Enable SSH Access". Click Save, then start the server.
This section warns of additional costs - see the Additional Infrastructure Costs section above.
Create or Update the Jupyter Server
If the server was already running before your key was added, it will need to be stopped and restarted to pick up the newly-created key.
Connecting to the Server
Many tools should be compatible with this functionality. Below are instructions for some popular options. For all options, the SSH URL is found in the server's details:
Note that this URL may change if the server is stopped, including auto-shutoff.
Using the terminal application of your choice, the server can be accessed via:
ssh <server URL>
If your key is not added to your ssh agent (or no ssh agent is running), the key can be manually specified:
ssh -i path/to/key <server URL>
Note: this functionality is only available in the Professional edition of Pycharm - it is not available in the Community (free) edition.
To set up PyCharm to connect to a running Jupyter server, follow Jetbrains' instructions here: https://www.jetbrains.com/help/pycharm/creating-a-remote-server-configuration.html
Choose SFTP for the credentials type and create a new SSH configuration. Use the following values:
- Host: The hostname from the Jupyter Server details (see screenshot above) - remove
- Port: 22
- User name:
- Authentication type: Key pair
- Private key file: Path to your private key
- Passphrase: The passphrase to your key, if you set one
Once the new server configuration has been added, navigate to Tools > Deployment > Remote Host. From the new panel this opens, select the new server configuration you just created. This will let you browse the contents of the server, and edit the files in place. Your project is located at
/home/jovyan/project . From Tools > Start SSH Session... a terminal can be opened to run commands.
Visual Studio Code (VS Code)
To make configuration easy, it is suggested to add an entry to your
~/.ssh/config file (create it if it doesn't exist):
HostName <your server hostname>
Update the name above to match your server as you see fit. Then, from the command pallette (Ctrl+Shift+P or Cmd+Shift+P, depending on OS), select Remote-SSH: Connect to host..., then select your config entry (created above) from the list. Once opened, select "Open Folder", then choose
/home/jovyan/project . The project's files can be opened directly, and
bash is available if you would like to open a terminal through VS Code.