The SSH feature in Saturn Cloud lets you connect to Jupyter server and RStudio server resources directly from your local machine. This allows you to use IDEs such as VSCode, PyCharm, or to interact with the resources from a terminal. You can also use SSH to move files to and from your local machine.
To use SSH in Saturn Cloud, you must do the following:
- Set up an SSH key pair.
- Add the public key to Saturn Cloud.
- Enable SSH access to your resource.
Set up an SSH key pair
You need to set up SSH to make the connection between Saturn Cloud and your local machine. First, create an SSH key pair.
If you need help setting up the SSH keys on your local machine, check out any of these online resources:
Once you have your key pair set up, add your SSH public key to your Saturn Cloud account. The SSH private key will stay on your local machine.
Add your SSH public key to Saturn Cloud
Sign in to your Saturn Cloud account, click on your username, and select User Settings from the menu on the left. There, add your SSH credential information. This is a secure storage location, and it will not be available to the public or other users without your consent.
Under “Access Keys”, find a section called “Resource Connection SSH Keys.” Click on New, and you will be taken to the SSH key creation form.
Select the appropriate owner, give the key a name, and copy the entire contents of your SSH public key file into the “Value” section.
With this complete, your SSH credentials will be accessible by Saturn Cloud resources!
Actively running resourcesIf you have resources that are running when you upload a new SSH public key, the resources will need to be restarted before the key can be used to connect.
Enable SSH for a Jupyter server or RStudio server resource
On the resource page, click Edit to edit the resource details. If it is running, you may want to stop it since the resource will need to be restarted when you make this change.
You will be taken to a page that allows you to edit the settings of the server. Check the box that says “Allow SSH Connections,” and click Save at the bottom of the page.
Start the resource, and you will see an SSH URL provided on the instance’s card. Press the clipboard icon to copy this string.
Connect to an external IDE
Now you can set up the connection to your preferred IDE. You’ll need to provide the IDE with the following:
- Host: Also called “Hostname” or “Server Hostname”. This is the part to the right of the
@in the URL above.
- User: This is the part to the left size of the
@in the URL above.
- Private key filepath: This is the location on your computer where the SSH private key is stored. This is the complement to the SSH public key you saved in Saturn Cloud.
Remote - SSH plugin, VS Code can connect to the running resource directly. To set this up, follow these instructions:
From the command palette (Ctrl+Shift+P or Cmd+Shift+P, depending on OS), select Remote-SSH: Connect to host…, then select + Add New SSH Host…. Paste the string copied from the resource card when prompted to enter the SSH command. VSCode will automatically parse the host and user values for you.
Add the entry to your
~/.ssh/config file. Open the file, and you will see an entry in the form:
Host <Host> HostName <Host (see above)> User <User (see above)>
Update the name (to the right of “Host”) above to match your server as you see fit. Then, from the command palette, select Remote-SSH: Connect to host…, then select your config entry name from the list.
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 resource, follow JetBrains’ instructions here:
Choose SFTP for the credentials type, and create a new SSH configuration. Use the following values:
- Host: <Host (see above)>
- Port: 22
- User name: <User (see above)>
- Authentication type: Key pair
- Private key file: <Private key filepath (See above)>
- 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 that this opens, select the new server configuration you just created.
To open a terminal to run commands, navigate to Tools > Start SSH Session…
Using the terminal application of your choice, the server can be accessed via:
ssh <resource 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 <resource URL>
Move files to and from your local machine
To see examples of moving data to and from your local machine using SSH, see our loading data examples: