-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Bug with the sagemaker.get_execution_role() #2186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Similar issue: #2089 |
Hey @szamarin, Is the name of the role that you are using contain SageMakerExecutionRole? If the name of your role doesn't contain If the Role Arn is different than what is expected, then it may be due to the role that is being assumed in your SageMaker Studio is different than what you are expecting, as we call STS's get_caller_identity() to retrieve the corresponding role name. You may need to add IAM read permissions to your role or pass the Role Arn directly, as I believe there isn't a proper way to get the path without it. When you attempt to call |
Potentially related PR: #2191 |
I also ran in to a related issue today, trying to use a role which is under a custom prefix (not
So I think there's a chance this issue as described might now be fixed in the library? But even if so, seems like the fix is not yet propagated to all SageMaker Studio kernel images. |
Hey
I had it fixed by adding
justification for adding the above 2 roles..
Hope this addresses your issue too |
Closing as fixed, please reopen if you think otherwise. Thank you! |
Describe the bug
When using get_execution_role() in SageMaker Studio with a non generated IAM role, the method does not return the correct ARN unless the role name contains "AmazonSageMaker-ExecutionRole" and is placed into the "/service-role/" path. These are hard coded into the get_caller_identity_arn() method of sagemaker session. This becomes an issue when deploying the role with CloudFormation. The logical id can not contain dashes, so when I create a role like this:
The method will fail to include /service-role/ in the arn. I have to explicitly specify the RoleName, or place the role into the root path.
To reproduce
Create a sagemaker execution role without including "AmazonSageMaker-ExecutionRole" in its name and place that role under the "/service-role/" path. Assign the role to a SageMaker Studio domain or user profile. Run sagemaker.get_execution_role() in a Studio notebook. The returned arn will not include "service-role" in the path.
Expected behavior
get_execution_role() should always return the correct arn
The text was updated successfully, but these errors were encountered: