- A private key you must keep secret
- A public key stored in your Upsun account
Add SSH keys
If you don’t have keys already added, you might be able to find existing keys or else you need to generate new keys.1A. Find your keys
If you haven’t used SSH keys before or it’s been a while since you created the key, skip right to generating new keys. If you have generated SSH keys before and want to find them on your system, follow these instructions. A public key file has a name ending in.pub.
It contains seemingly random lines of characters,
like this example of a public RSA key
(note the email address at the end, which wouldn’t be present in a private key):
- Open a terminal.
-
Run the following commands:
.pub,
copy the location and add it to your Upsun account.
If you don’t find an existing key, generate new keys.
1B. Generate new keys
If you’re logged in using the Upsun CLI, generate a key and have it added to your Upsun account automatically.-
In a terminal, run
upsun ssh-key:add. - If necessary, log in to a browser.
-
Press
Yandenterto create a new SSH key. - Copy the location of the generated key.
-
Run the following commands (replacing
<VariableBlock name="PATH_TO_YOUR_KEY" />with the location you copied):
2. Add an SSH key to your account
Once you have the location of your public key, add it to your Upsun account. If you’re logged in using the Upsun CLI, in a terminal run the following command (replacing<VariableBlock name="PATH_TO_YOUR_KEY" /> with the location of your public key):
3. Connect to your server with SSH keys
To connect to a server using SSH keys, find the details in the Console:- Open the Upsun Console.
- Select a project.
- In the Environment dropdown, select the environment you want to access.
- Click the SSH dropdown.
- Copy the ssh command for where you want access.
(Example:
ssh abcdefghi5k-main-7rqtwti--app@ssh.us-2.upsun.com) - Enter the command into a terminal.
Forwarding keys by default
It may be helpful to set your SSH client to always forward keys to Upsun servers, which can simplify other SSH or rsync commands. To do so, include a block in your local~/.ssh/config file like so:
Host entry for each Upsun region you want to connect to, such as us-2 or eu-4.
(You can include other configuration as desired.)