Comments (3)
AWS support recommended below solution:
This seems to be a known issue when executing the code locally, as mentioned in the following Github issue [3]. A work-around to fix the issue is also defined in that issue [3] and can be referred to using the following link: aws/sagemaker-python-sdk#300 (comment)
The steps in the work-around given in the above link are:
1. Login to the AWS console -> IAM -> Roles -> Create Role
2. Create an IAM role and select the "SageMaker" service
3. Give the role "AmazonSageMakerFullAccess" permission
4. Review and create the role
5. Next, also attach the "AWSRoboMakerFullAccess" permission policy to the above created role (as required in the Github notebook [1]).
6. The original code would then need to be modified to fetch the IAM role directly when the code is executed on a local machine. The code snippet to be used is given below:
try:
sagemaker_role = sagemaker.get_execution_role()
except ValueError:
iam = boto3.client('iam')
sagemaker_role = iam.get_role(RoleName='<sagemaker-IAM-role-name>')['Role']['Arn']
In the above snippet, replace the "" text with the IAM role name created in Step 4.
References:
[1] https://github.com/aws-samples/aws-deepracer-workshops/blob/master/log-analysis/DeepRacer%20Log%20Analysis.ipynb
[2] https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-ex-role.html
[3] aws/sagemaker-python-sdk#300
from aws-deepracer-workshops.
from aws-deepracer-workshops.
@AachenAU Good point. I tried but getting a different error which is
----> 4 sagemaker_role = sagemaker.get_execution_role('sagemaker')
/opt/conda/lib/python3.7/site-packages/sagemaker/session.py in get_execution_role(sagemaker_session)
3314 if not sagemaker_session:
3315 sagemaker_session = Session()
-> 3316 arn = sagemaker_session.get_caller_identity_arn()
AttributeError: 'str' object has no attribute 'get_caller_identity_arn'
The full error is below:
Couldn't call 'get_role' to get Role ARN from role name arn:aws:iam::26********:root to get Role path.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-9bb111bb0794> in <module>
1 try:
----> 2 sagemaker_role = sagemaker.get_execution_role()
3 except:
/opt/conda/lib/python3.7/site-packages/sagemaker/session.py in get_execution_role(sagemaker_session)
3323 )
-> 3324 raise ValueError(message.format(arn))
3325
ValueError: The current AWS identity is not a role: arn:aws:iam::26********:root, therefore it cannot be used as a SageMaker execution role
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-6-9bb111bb0794> in <module>
2 sagemaker_role = sagemaker.get_execution_role()
3 except:
----> 4 sagemaker_role = sagemaker.get_execution_role('sagemaker')
5
6 print("Using Sagemaker IAM role arn: \n{}".format(sagemaker_role))
/opt/conda/lib/python3.7/site-packages/sagemaker/session.py in get_execution_role(sagemaker_session)
3314 if not sagemaker_session:
3315 sagemaker_session = Session()
-> 3316 arn = sagemaker_session.get_caller_identity_arn()
3317
3318 if ":role/" in arn:
AttributeError: 'str' object has no attribute 'get_caller_identity_arn'
from aws-deepracer-workshops.
Related Issues (20)
- Need access to the console to practice HOT 1
- The simulator might has a bug, my simulator is aways starts from (0,0) coor. HOT 2
- Kumo Torakku training track HOT 1
- Log downloads NoRegionError. HOT 1
- Change track size
- Need to add Championship Cup Warm-up track
- AWS Summit Raceway track npy file HOT 6
- NameError: name 'plt' is not defined
- KeyError: 'outputLocation' when trying to get all the info
- Wifi light neither turns red nor blue
- Sample reward_function method documentation wrong HOT 1
- Unable to open notebook `DeepRacer Log Analysis.ipynb`
- Model load failed Error
- Error : UnknownServiceError HOT 1
- Track waypoint data documentation HOT 1
- Wrong Community Slack link in the Readme
- Lab 1 - Section 3 : outdated content
- Fix code scanning alert - Incomplete URL substring sanitization HOT 2
- Broken link HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-deepracer-workshops.