-
Notifications
You must be signed in to change notification settings - Fork 1.2k
change: move service-role path parsing for AmazonSageMaker-ExecutionRole for get_execution_role() into except block of IAM get_role() call and add warning message #2191
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
Conversation
…ole for get_execution_role() into except block of IAM get_role() call and add warning message
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…ole for get_execution_role() into except block of IAM get_role() call and add warning message
Issue #, if available:
#2089
Description of changes:
Moved the conditional for parsing a Role Arn if the role name contains
AmazonSageMaker-ExecutionRole
into the except block of the try/except clause for calling IAMget_role()
.This change should work for users who are still depending on this logic for getting a proper role ARN without IAM read permissions, while also allowing those with IAM read permissions to get the correct path in their role.
Also added a warning message.
Testing done:
I tested my change by creating separate UserProfiles with the corresponding roles defined below.
If my assumed role contained
AmazonSageMaker-ExecutionRole
and didn't have IAM permissions, it default to the role with the path service-role. It doesn't seem possible to get the role path through STS in the perspective of the Python SDK.I installed my Python SDK dist file in each notebook:
AmazonSageMaker-ExecutionRole
import sagemaker
sagemaker.get_execution_role()
arn:aws:iam::AWS_ACCOUNT:role/service-role/AmazonSageMaker-ExecutionRole-20181116T200565
AmazonSageMaker-ExecutionRole
import sagemaker
sagemaker.get_execution_role()
arn:aws:iam::AWS_ACCOUNT:role/AmazonSageMaker-ExecutionRole-NO_PATH
AmazonSageMaker-ExecutionRole
import sagemaker
sagemaker.get_execution_role()
arn:aws:iam::AWS_ACCOUNT:role/SageMakerRole
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
unique_name_from_base
to create resource names in integ tests (if appropriate)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.