aws-samples / aws-samples/sagemaker-ssh-helper
Add support for AWS profiles in SSHProcessorWrapper
- Dominant language
- Python
- Stars
- 261
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am using https://github.com/aws-samples/sagemaker-ssh-helper to connect to a Processing Sagemaker job to help with debugging.
I got it working with some some hacks to use my AWS role profile as the code does not accept roles at the moment. Could it be possible to improve that functionality to support profile roles in an easier way?
For example in my code I had to do this (using a `boto3` session previously initialised with my profile):
```
sts = session.client("sts")
local_user_id = sts.get_caller_identity()["UserId"]
ssh_wrapper = SSHProcessorWrapper(
processor=script_processor,
connection_wait_time_seconds=connection_wait_time_seconds,
)
ssh_wrapper.local_user_id = local_user_id
ssh_wrapper._augment()
```
Is there an easier way to get that working? Unfortunately the create method here does not accept `local_user_id` as argument, or any `boto3` session or profile to use: https://github.com/aws-samples/sagemaker-ssh-helper/blob/1a45feba34251e349bee1ebe0f653c92ff471e36/sagemaker_ssh_helper/wrapper.py#L554
Ideally I would like to pass to the create method my AWS profile instead. Even passing the `local_user_id` would be an improvements, but not as nice.
Also, another problem I have with the hack above is that even though I got the solution working, the methods `get_instance_ids` and `print_ssh_info` fail with: " ERROR: NoCredentialsError calling ssm". Is there a way to get these working with some other workaround?
Contributor guide
Assessment
This issue has not been assessed yet.