-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
"Access key or secret key are null" while using InstanceProfileCredentialsProvider.getCredentials() #3117
Comments
Any ETA on getting assistance with this or getting it triaged? |
Still looking for some assistance with this, thanks! |
@ChrisCollinsIBM looking at the logs provided in the Current Behavior, there's two separate calls to generate a session TOKEN, both are successful (don't know why there's two calls, though). I'm guessing this is the call to obtain the credentials associated with the instance role "example-ec2-instance-role":
which is also successful. I'm not quite clear in what moment the error "Unable to load credentials" is thrown, in the logs the stacktrace seems to be cut out from the timeline. Is it immediately after the last [DEBUG] line? |
Yes @debora-ito, that exception is thrown right after, there's no try/catch block logging the exception so you're not seeing a timestamp as the exception is just thrown, and it's the result of the code above logged in the issue but I'll repeat it here:
As you mention I believe there are 2 calls because call one is to
This isn't happening in our environment but on a customer, and I did have them run a shell script to run a CURL to hit the |
The customer got the issue resolved, but we unfortunately didn't get any information on what fixed it. I'll close this issue since there's nothing to actually fix or reproduce at this point, but it'll remain searchable If someone else hits it. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Upcoming End-of-Support
Describe the bug
We have a customer that when using EC2 instance credentials via
com.amazonaws.auth.InstanceProfileCredentialsProvider.getCredentials()
we're getting an error backUnable to load credentials. Access key or secret key are null
No errors are coming back from the
EC2ResourceFetcher
but no temporary keys are being retrieved.We verified via CURL that IMDSv2 is enabled, and the basic curl to get a token and get temporary credentials from
/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance
does return credentials but the above workflow that tries to get credentials based on the named role returned fromlatest/meta-data/iam/security-credentials/
returns the error shown below in Current BehaviourExpected Behavior
Temporary credentials should be retrieved via the IMDSv2 endpoint, and if they cannot be a more useful error should be presented around permissions or some other issue.
Current Behavior
This output is the result of the following java code:
This was run using
This same code run on another EC2 instance with the same jars works fine.
Reproduction Steps
Outline in previous step
Wire logs are not available as this portion of the SDK uses HTTPUrlConnection instead of HTTPClient so we cannot get the response in the logging without modifying the classes and re-building.
Possible Solution
No solution in mind, additional logging would be helpful to see the raw response.
Additional Information/Context
Trying to understand why this isn't working but also no relevant errors are seen. I don't believe calls to IMDS endpoints are logged in CloudTrail so I don't know if any logging would be there that the customer would be able to look at.
The system and AWS account are at arms length from us and we're restricted in troubleshooting, but we're unable to re-create this issue in our environment at all but have the output to show it is happening.
Any assistance is greatly appreciated.
AWS Java SDK version used
1.12.675
JDK version used
1.8.0_401
Operating System and version
Red Hat Enterprise Linux Server release 7.9 (Maipo)
The text was updated successfully, but these errors were encountered: