File size: 3,937 Bytes
76d9c4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
title: Create an SSH connection
version: EN
---

Once you run a workspace, you can fully leverage the development environment using SSH.

<img style={{ borderRadius: '0.5rem' }}
  src="/images/workspace/ssh/1_ssh.png"
/>

<img style={{ borderRadius: '0.5rem' }}
  src="/images/workspace/ssh/2_ssh.png"
/>

### 1. Create SSH Key

To enable SSH connection, you first need a SSH key pair. Once you obtained a public key for your account and workspace instance, you can connect it with a private key.&#x20;

```
$ ssh-keygen -t ed25519 -C "vessl-floyd"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/floyd/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/floyd/.ssh/id_ed25519.
Your public key has been saved in /Users/floyd/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:78yjMGcJoV73v/jkLHIRhdC0wL0FBL6c68T0MZGoV2Q savvihub-floyd
The key's randomart image is:
+--[ED25519 256]--+
|       .+BEo     |
|       ..=+oo    |
|      . o =+     |
|     . + +o.     |
|    . + S o.     |
|   . . * *.o     |
|    . o B +..    |
|       B.++*     |
|        o+=+*.   |
+----[SHA256]-----+
```

### 2. Add SSH public key to your VESSL account

You can add your SSH public key to your account using VESSL CLI. The added keys will be injected to every running workspaces you created. You can manage your keys with `vessl ssh-key list` and `vessl ssh-key delete` commands.

```
$ vessl ssh-key add
[?] SSH public key path: /Users/floyd/.ssh/id_ed25519.pub
[?] SSH public key name: vessl-floyd

Successfully added.
```

### 3. Connect via CLI

If there are more than one running workspaces, you will be asked to select one to connect.

```
$ vessl workspace ssh
The authenticity of host '[tcp.apne2-prod1-cluster.savvihub.com]:30787 ([52.78.240.117]:30787)' can't be established.
ECDSA key fingerprint is SHA256:iSexO7W1U14P3Pp6wRfPleHABQQMek/JAgb5kHqg5Jw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.14.238-182.422.amzn2.x86_64 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

vessl@workspace-9670nnkn5l16-0:~$ 
```

### 4. Setup VSCode Remote-SSH plugin config

You can also add your workspace to VSCode Remote-SSH plugin config. `vessl workspace vscode` adds the information to `~/.ssh/config` so that the workspace can show up in the host list.

```
$ vessl workspace vscode
Successfully updated /Users/floyd/.ssh/config

$ cat ~/.ssh/config
Host acceptable-bite-1627438220
    User vessl
    Hostname tcp.apne2-prod1-cluster.savvihub.com
    Port 30787
    StrictHostKeyChecking accept-new
    CheckHostIP no
    IdentityFile /Users/floyd/.ssh/id_ed25519
```

<img style={{ borderRadius: '0.5rem' }}
  src="/images/workspace/ssh/3_vscode.png"
/>

<img style={{ borderRadius: '0.5rem' }}
  src="/images/workspace/ssh/4_vscode.png"
/>

<img style={{ borderRadius: '0.5rem' }}
  src="/images/workspace/ssh/5_vscode.png"
/>

### 5. Manual Access&#x20;

You can integrate with other IDEs and make SSH connection without VESSL CLI using the host, username, and port information. In this case, the host is `tcp.apne2-prod1-cluster.savvihub.com`, username `vessl`, and port `30787`. The full SSH command is `ssh -p 30787 -i ~/.ssh/id_ed25519 vessl@tcp.apne2-prod1-cluster.savvihub.com`.