1+ See https ://pdf . plantuml . net /PlantUML_Language_Reference_Guide_en . pdf
2+
3+ @startuml
4+ actor Developer as dev
5+ participant "SageMaker SSH Helper \n library (local)" as sm_ssh_helper_local
6+ participant "Amazon SageMaker Studio" as sagemaker_studio
7+ participant "VPC \n private or managed" as vpc
8+ participant "SageMaker SSH Helper \n library (remote)" as sm_ssh_helper_remote
9+ participant "SSH server" as ssh
10+ participant "SSM agent" as ssm_agent
11+ participant "AWS Systems Manager \n (SSM)" as ssm
12+ participant "IAM" as iam
13+
14+ dev -> sagemaker_studio : Create kernel gateway app
15+ note left of dev
16+ Ex.:
17+ Data Science 2.0
18+ end note
19+
20+ sagemaker_studio -> vpc : Start containers
21+ activate vpc
22+ vpc -> vpc : Start kernel gateway
23+ note left vpc
24+ jupyter kernelgateway
25+ end note
26+ activate vpc
27+
28+
29+ dev -> vpc : Run life-cycle configuration
30+ note left of dev
31+ kernel-lc-config.sh
32+ end note
33+
34+ dev -> vpc : Alternatively, run IDE notebook
35+ note left of dev
36+ SageMaker_SSH_IDE.ipynb
37+ end note
38+
39+
40+ vpc -> sm_ssh_helper_remote : Setup IDE
41+ activate vpc
42+
43+ activate sm_ssh_helper_remote
44+
45+ sm_ssh_helper_remote -> sm_ssh_helper_remote : Print connect metadata
46+
47+ note left sm_ssh_helper_remote
48+ sm - ssh - ide
49+ get - metadata
50+ end note
51+
52+ sm_ssh_helper_remote --> dev :
53+
54+ note right dev
55+ App name : sagemaker - data - science - ml - m5 - large - 1234567890abcdef0
56+ User profile name : terry - whitlock
57+ Domain : d - egm0dexample
58+ end note
59+
60+ sm_ssh_helper_remote -> sm_ssh_helper_remote : Configure and \n install IDE libs
61+ note left sm_ssh_helper_remote
62+ sm - ssh - ide
63+ configure
64+ end note
65+
66+
67+ sm_ssh_helper_remote -> sm_ssh_helper_remote : Configure and \n install SSH libs
68+ activate sm_ssh_helper_remote
69+ note right sm_ssh_helper_remote
70+ sm - setup - ssh
71+ configure
72+ end note
73+ deactivate sm_ssh_helper_remote
74+
75+
76+ sm_ssh_helper_remote -> sm_ssh_helper_remote : Initialize SSM
77+ activate sm_ssh_helper_remote
78+ note left sm_ssh_helper_remote
79+ sm - ssh - ide
80+ init - ssm
81+ end note
82+
83+ note right sm_ssh_helper_remote
84+ sm - init - ssm
85+ end note
86+ sm_ssh_helper_remote -> ssm : Create activation
87+ sm_ssh_helper_remote -> ssm_agent : Register
88+ ssm_agent -> ssm :
89+ note right ssm_agent
90+ mi -0 1234567890abcdef
91+ end note
92+ ssm --> ssm_agent :
93+ deactivate sm_ssh_helper_remote
94+
95+ note left sm_ssh_helper_remote
96+ sm - ssh - ide
97+ start
98+ end note
99+
100+ sm_ssh_helper_remote -> sm_ssh_helper_remote : Save environment \n for remote shell
101+ note right sm_ssh_helper_remote
102+ sm - save - env
103+ end note
104+
105+ sm_ssh_helper_remote -> ssh : Start SSH server
106+ activate ssh
107+
108+ sm_ssh_helper_remote -> sm_ssh_helper_remote : Start VNC and \n Jupyter server
109+
110+
111+ sm_ssh_helper_remote -> ssm_agent : Start SSM agent
112+ note left sm_ssh_helper_remote
113+ sm - ssh - ide
114+ ssm - agent
115+ end note
116+ activate ssm_agent
117+ ssm_agent -> ssm : Go online
118+
119+
120+ note right dev
121+ sm - local - ssh - ide set - domain d - egm0dexample
122+ sm - local - ssh - ide set - user terry - whitlock
123+ end note
124+
125+ note right dev
126+ sm - local - ssh - ide connect sagemaker - data - science - ml - m5 - large - 1234567890abcdef0
127+ end note
128+ dev -> sm_ssh_helper_local : Connect
129+ sm_ssh_helper_local -> sm_ssh_helper_local : Get instance IDs
130+ sm_ssh_helper_local -> ssm : List and filter instances
131+ sm_ssh_helper_local -> sm_ssh_helper_local : Repeat until successful \n or timeout
132+
133+ note right sm_ssh_helper_local
134+ mi -0 1234567890abcdef, ...
135+ end note
136+
137+ activate sm_ssh_helper_local
138+ note right sm_ssh_helper_local
139+ sm - connect - ssh - proxy mi -0 1234567890abcdef
140+ end note
141+ sm_ssh_helper_local -> sm_ssh_helper_local : Generate SSH key pair
142+ sm_ssh_helper_local -> ssm : Copy SSH public key through S3
143+
144+ ssm -> iam : Check SendCommand \n permissions
145+ ssm -> ssm_agent : Run command
146+ ssm_agent -> ssm_agent : Copy key from S3
147+ sm_ssh_helper_local -> ssm : Start SSH session proxy \n over SSM
148+
149+ ssm -> iam : Check StartSession \n permissions
150+
151+ ssm -> ssm_agent : Start SSH session
152+ ssm_agent -> ssm_agent : Start SSH proxy tunnel
153+ ssm_agent --> sm_ssh_helper_local :
154+ sm_ssh_helper_local -> ssm_agent : Start SSH port forwarding \n over SSM proxy tunnel
155+ ssm_agent -> ssh : Start SSH proxy \n tunnel session
156+ activate ssh
157+
158+
159+ dev -> dev : Connect from IDE
160+ activate dev
161+ note right dev
162+ ssh sagemaker - studio
163+ end note
164+ dev -> ssh : Connect with SSH through forwarded SSH port
165+ ssh --> dev :
166+
167+ dev -> vpc : Run and debug code remotely with IDE
168+ deactivate dev
169+
170+ dev -> vpc : Open Jupyter \n in browser
171+ dev -> vpc : Connect with \n VNC client
172+
173+ ... Development is in progress...
174+
175+ dev -> sm_ssh_helper_remote : Interrupt notebook kernel and stop services
176+
177+ note left sm_ssh_helper_remote
178+ sm - ssh - ide
179+ stop
180+ end note
181+
182+ sm_ssh_helper_remote -> ssm_agent : Stop SSM agent
183+ deactivate ssm_agent
184+
185+ sm_ssh_helper_remote -> ssh : Stop SSH server
186+ deactivate ssh
187+
188+ deactivate ssh
189+
190+ sm_ssh_helper_remote -> sm_ssh_helper_remote : Stop VNC and \n Jupyter server
191+
192+ deactivate vpc
193+ deactivate sm_ssh_helper_remote
194+
195+ dev -> vpc : Stop app
196+
197+
198+
199+ deactivate vpc
200+
201+ deactivate vpc
202+ deactivate sm_ssh_helper_local
203+
204+ @enduml
0 commit comments