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
Describe the bug
When using sagemaker.jumpstart.model method and an assumed role (cross-accounts) via Boto3, the call to JumpStartModel fails with a denial for a GetObject call. When running this without the AssumeRole, the same code works fine. However, due to some compliance requirements, I need to assume the role and run the code.
I can also create a model, endpoint, etc, using pure Boto3 however, I lose some of the abstraction, so I'd prefer to use the Sagemaker SDK.
To reproduce
Attempt to use the Jumpstart method while also using an assumed role. I am using this script:
Expected behavior
I expect a model, endpoint configuration, and endpoint to be created based on the parameters specified.
Screenshots or logs
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 7, in create_jumpstart_model
File "/usr/local/lib/python3.11/site-packages/sagemaker/jumpstart/model.py", line 266, in __init__
if not _is_valid_model_id_hook():
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sagemaker/jumpstart/model.py", line 259, in _is_valid_model_id_hook
return is_valid_model_id(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sagemaker/jumpstart/utils.py", line 592, in is_valid_model_id
models_manifest_list = accessors.JumpStartModelsAccessor._get_manifest(region=region)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sagemaker/jumpstart/accessors.py", line 97, in _get_manifest
return JumpStartModelsAccessor._cache.get_manifest() # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sagemaker/jumpstart/cache.py", line 342, in get_manifest
manifest_dict = self._s3_cache.get(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sagemaker/utilities/cache.py", line 103, in get
self.put(key)
File "/usr/local/lib/python3.11/site-packages/sagemaker/utilities/cache.py", line 126, in put
value = self._retrieval_function( # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sagemaker/jumpstart/cache.py", line 323, in _retrieval_function
formatted_body, etag = self._get_json_file(s3_key, file_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sagemaker/jumpstart/cache.py", line 266, in _get_json_file
file_content, etag = self._get_json_file_and_etag_from_s3(key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sagemaker/jumpstart/cache.py", line 243, in _get_json_file_and_etag_from_s3
response = self._s3_client.get_object(Bucket=self.s3_bucket_name, Key=key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/botocore/client.py", line 535, in _api_call
return self._make_api_call(operation_name, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/botocore/client.py", line 980, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the GetObject operation: Access Denied
If I create an S3 client with the same assumed session and try to fetch the manifest object (I'm assuming it is this one, maybe not: s3://jumpstart-cache-prod-us-west-2/models_manifest.json), I can do so:
A PR has been raised with a fix. In the meantime, to get unblocked, you may do pip install git+https://github.com/evakravi/sagemaker-python-sdk@fix/js-cache-s3-client to use a working version of sagemaker.
Describe the bug
When using
sagemaker.jumpstart.model
method and an assumed role (cross-accounts) via Boto3, the call toJumpStartModel
fails with a denial for a GetObject call. When running this without the AssumeRole, the same code works fine. However, due to some compliance requirements, I need to assume the role and run the code.I can also create a model, endpoint, etc, using pure Boto3 however, I lose some of the abstraction, so I'd prefer to use the Sagemaker SDK.
To reproduce
Attempt to use the Jumpstart method while also using an assumed role. I am using this script:
Expected behavior
I expect a model, endpoint configuration, and endpoint to be created based on the parameters specified.
Screenshots or logs
Error:
If I create an S3 client with the same assumed session and try to fetch the manifest object (I'm assuming it is this one, maybe not:
s3://jumpstart-cache-prod-us-west-2/models_manifest.json
), I can do so:System information
A description of your system. Please provide:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: