Skip to content

Add support for AWS profiles in SSHProcessorWrapper #65

@ignacio-amaya-rovio

Description

@ignacio-amaya-rovio

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:

def create(cls, processor: sagemaker.processing.Processor,

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions