You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: FAQ.md
+57-4Lines changed: 57 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,12 @@ The scripts like `sm-local-ssh-ide` and `sm-local-ssh-training` will now work fr
36
36
Git Bash session under a regular user, and you may continue to work in your local IDE
37
37
on Windows as usual.
38
38
39
+
### Are SageMaker notebook instances supported?
40
+
41
+
Yes, the setup is similar to SageMaker Studio. Run [SageMaker_SSH_Notebook.ipynb](SageMaker_SSH_Notebook.ipynb) on the notebook instance and `sm-local-ssh-notebook connect <<notebook-instance-name>>` your local machine.
42
+
43
+
Review the instructions for [SageMaker Studio integration with PyCharm / VSCode](README.md#studio) for the rest of details.
44
+
39
45
### How do you start the SSM session without knowing EC2 instance or container ID?
40
46
41
47
Indeed, when you run a SageMaker job, there are no EC2 instances or generic containers visible in AWS console, because the instances and containers are managed by the SageMaker service.
@@ -69,7 +75,7 @@ Yes, requires adding same IAM permissions to SageMaker role as described in the
69
75
70
76
### How SageMaker SSH Helper protects users from impersonating each other?
71
77
72
-
This logic is enforced by IAM policy. See the step 3b in [IAM_SSM_Setup.md](https://github.com/aws-samples/sagemaker-ssh-helper/blob/main/IAM_SSM_Setup.md)
78
+
This logic is enforced by IAM policy. See the manual step 3 in [IAM_SSM_Setup.md](IAM_SSM_Setup.md#manual-setup)
73
79
for a policy example.
74
80
75
81
It works as follows: the SageMaker SSH Helper assigns on behalf of the user the tag `SSHOwner`
@@ -81,7 +87,7 @@ When a user attempts to connect to an instance, IAM will authorize the user base
81
87
on their ID and the value of the `SSHOwner` tag. The user will be denied to access the instance
82
88
if the instance doesn't belong to them.
83
89
84
-
Another important part of it is the IAM policy with `ssm:AddTagsToResource` action, described in the step 1d.
90
+
Another important part of it is the IAM policy with `ssm:AddTagsToResource` action, described in the manual step 2.
85
91
Limiting this action only to SageMaker role as a resource will allow adding and updating tags only for
86
92
the newly created activations (instances) and not for existing ones that may already belong to other users.
87
93
@@ -115,6 +121,8 @@ In this case, make sure that SageMaker SSH Helper is installed in your `Dockerfi
115
121
RUN pip --no-cache-dir install sagemaker-ssh-helper # <--NEW--
116
122
```
117
123
124
+
**Important:** Make sure that the version installed into the container matches the version of the library on your local machine.
125
+
118
126
The code for running estimators and inference will look like this:
See [#7](https://github.com/aws-samples/sagemaker-ssh-helper/issues/7) for this request.
189
197
198
+
### What if I want to use an estimator in a hyperparameter tuning job (HPO) and connect to a stuck training job with SSM?
199
+
200
+
In this case, `wrapper.get_instance_ids()` won't really work because you don't call `fit()` directly on the estimator and SSH Helper does not understand what training job you are trying to connect to.
201
+
202
+
You should use extra lower-level APIs to fetch the training job name of your interest first, and then either use `SSMManager` (recommended) or `SSHLog` (slower) to fetch their instance ids from the code:
203
+
204
+
```python
205
+
import time
206
+
207
+
from sagemaker.mxnet import MXNet
208
+
from sagemaker.tuner import HyperparameterTuner
209
+
210
+
from sagemaker_ssh_helper.manager import SSMManager
211
+
from sagemaker_ssh_helper.wrapper import SSHEstimatorWrapper
print(f'To connect over SSM run: aws ssm start-session --target {instance_ids[0]}')
239
+
```
240
+
241
+
*Note:* If you want to connect to a stuck training job from the command line with SSH, use `sm-local-ssh-training` script, as for any other regular training job.
242
+
190
243
### How to start a job with SageMaker SSH Helper in an AWS Region different from my default one?
There’s plenty of methods already available for you to automate everything.
240
293
Take a loot at the [end-to-end automated tests](https://github.com/aws-samples/sagemaker-ssh-helper/blob/main/tests/test_end_to_end.py) as an example.
241
294
242
-
There's `get_instance_ids()` method already mentioned in the documentation. Underlying automation methods are available in the [SSHLog class](https://github.com/aws-samples/sagemaker-ssh-helper/blob/main/sagemaker_ssh_helper/log.py).
295
+
There's `get_instance_ids()` method already mentioned in the documentation. Underlying automation methods are available in the [SSMManager class](https://github.com/aws-samples/sagemaker-ssh-helper/blob/main/sagemaker_ssh_helper/manager.py) and the [SSHLog class](https://github.com/aws-samples/sagemaker-ssh-helper/blob/main/sagemaker_ssh_helper/log.py).
243
296
244
297
Also check the method `start_ssm_connection_and_continue()` from the [SSHEnvironmentWrapper class](https://github.com/aws-samples/sagemaker-ssh-helper/blob/main/sagemaker_ssh_helper/wrapper.py) - it automates creating the SSH tunnel, running remote commands and stopping the waiting loop as well as graceful disconnect. Underlying implementation is in the [SSMProxy class](https://github.com/aws-samples/sagemaker-ssh-helper/blob/main/sagemaker_ssh_helper/proxy.py).
245
298
@@ -277,7 +330,7 @@ An error occurred (BadRequest) when calling the StartSession operation: Enable a
277
330
```
278
331
279
332
First, check that your instance shows as an advanced instance in Fleet Manager.
280
-
If it doesn't show up there, you've probably missed the step "2h"in [IAM_SSM_Setup.md](IAM_SSM_Setup.md).
333
+
If it doesn't show up there, you've probably missed the manual step 1in [IAM_SSM_Setup.md](IAM_SSM_Setup.md#manual-setup).
281
334
282
335
Also check that you're connecting from the same AWS region. Run the following command on your local machine and check that the region is the same as in your AWS console:
0 commit comments