sagemaker-python-sdk: Bug: change: use regional endpoint when creating AWS STS client #1026

Please fill out the form below.

System Information

  • Python 3.6.9
  • Sagemaker SDK 1.39.0

Describe the problem

PR #1026 introduced a bug by not using a scheme for a particular STS endpoint

Minimal repro / logs

sagemaker.get_execution_role(sagemaker_session)

Leads to this stack trace

  File "/Library/Caches/virtualenvs/gocentral-ml-sagemaker-0XKWRhha-py3.6/lib/python3.6/site-packages/sagemaker/session.py", line 1386, in get_caller_identity_arn
    "sts", endpoint_url=sts_regional_endpoint(self.boto_region_name)
  File "/Library/Caches/virtualenvs/gocentral-ml-sagemaker-0XKWRhha-py3.6/lib/python3.6/site-packages/boto3/session.py", line 263, in client
    aws_session_token=aws_session_token, config=config)
  File "/Library/Caches/pypoetry/virtualenvs/gocentral-ml-sagemaker-0XKWRhha-py3.6/lib/python3.6/site-packages/botocore/session.py", line 839, in create_client
    client_config=config, api_version=api_version)
  File "/Library/Caches/pypoetry/virtualenvs/gocentral-ml-sagemaker-0XKWRhha-py3.6/lib/python3.6/site-packages/botocore/client.py", line 86, in create_client
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/Library/Caches/pypoetry/virtualenvs/gocentral-ml-sagemaker-0XKWRhha-py3.6/lib/python3.6/site-packages/botocore/client.py", line 328, in _get_client_args
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/Library/Caches/pypoetry/virtualenvs/gocentral-ml-sagemaker-0XKWRhha-py3.6/lib/python3.6/site-packages/botocore/args.py", line 85, in get_client_args
    client_cert=new_config.client_cert)
  File "/Library/Caches/pypoetry/virtualenvs/gocentral-ml-sagemaker-0XKWRhha-py3.6/lib/python3.6/site-packages/botocore/endpoint.py", line 261, in create_endpoint
    raise ValueError("Invalid endpoint: %s" % endpoint_url)
ValueError: Invalid endpoint: sts.us-west-2.amazonaws.com

The endpoint.py requires a scheme and non is provided via the sts_regional_endpoint method.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (4 by maintainers)

Commits related to this issue

Most upvoted comments

It’s working for me:

  1. open the terminal and activate the right conda env used in jupyter
  2. pip install sagemaker==1.38.6
  3. reload the kernel in jupyter and import sagemaker package
  4. confirm that the 1.38 version is loaded
  5. the get_execution_role() should be working now.

Yeah, I am block now for the same thing, cannot use jupyter notebook even for demo notebooks, this issue is a headache, totally crazy a company as Amazon has this type of bugs

v1.39.1 has just been released, and should contain the fix.