-
Notifications
You must be signed in to change notification settings - Fork 314
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
Unable to retrieve AWS role name #1364
Comments
Error Log
|
hey @ahlag ! I was following the same guides and running into the same error. I will share how I fixed this, hopefully it helps you too. The google.auth library is trying to use the AWS Instance Metadata Service (IMDS) of your EC2 instance to grab the aws_role_name, aws_region, etc. There are 2 versions of IMDS, v1 is a request/response method and v2 is a session-oriented method, Google.auth supports both versions. To get the AWS region it is making a GET request to For me, the IMDSv2 session token was not being included in the request, making it a IMDSv1 request. However my EC2 instance was requiring IMDSv2, producing the same Steps to fix:
![]() ![]() If your organization requires IMDSv2 be required then I unfortunately don't know the steps needed to get around that but hopefully this gets you a little bit closer! Long story short: I think this is an issue with config on the AWS side which most of these Workload Identity Federation guides brush over and not actually a bug with the Google.auth library. |
Hey @sassmith, |
Ran into this as well, thanks @sassmith for the workaround. I also found a way to make it work with IMDSv2. Just append e.g.
The Node.js docs mention this in passing: https://cloud.google.com/nodejs/docs/reference/google-auth-library/latest The Python implementation is here: google-auth-library-python/google/auth/aws.py Lines 450 to 469 in 9c87ad0
|
Hi @zchenyu, @sassmith , @ahlag i try to add script
Error
is there a clue/resolved to this? I've searched but it's a bit strange with HTTP ERROR 415 Unsupported Media Type |
@tiolumbantobing -- For whatever reason this happens on Sagemaker notebooks. Removing this line seems to resolve the issue. It's unclear that the request header is needed at all. |
@zchenyu, for my k8s cluster the imdsv2_session_token_url is hanging forever. How to fix that? root@s3-puller-688ff8dfbf-ntk4r:/app# curl -iv http://169.254.169.254/latest/api/token
^C |
@larryzhu2018 , try to get token providing
After that you probably can get info about your EC2 instance:
The output should be list of metadata, for e.g. you can retrieve instance-id:
|
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
If you are still having issues, please be sure to include as much information as possible:
Environment details
google-auth
version: 2.22.0Steps to reproduce
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
The text was updated successfully, but these errors were encountered: