-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Aws::Errors::MissingCredentialsError exception in ECS when using TaskRoleArn #2981
Comments
Sorry you're running into this - you are right, credentials from ECS TaskRoleArn should just work. What is |
I'm not setting it, it's being set by ECS. It's being set to the following, redacting the UUID as I assume that's something I shouldn't share:
There's no other ENV vars that appear auth related. This is a complete set of container ENV vars, minus the ones specific to my app which have a unique, app-specific prefix:
|
From your host, can you try pinging We can get more insight if you try initializing these credentials manually:
|
Also please move away from |
Thanks for the quick response and good troubleshooting steps. Once I realized how this is supposed to work I was able to root cause the issue: The ECS agent metadata endpoint wasn't responding. Once I resolved that To try and reproduce the issue I ran a container without network and instantiated a
And I also reproduced the original exception as well. So this isn't a bug, as it failed due to the So I think we can remove the |
FYI https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/sns-example-send-message.html still documents using Aws::SNS::Resource. |
Related to: #2823 |
I'll contact the docs examples team to have that rewritten. Thanks for pointing that out. |
Path forward is to do Kernel.warn on various credential sources (EC2 instance, ECS, Process, etc) when they aren't loaded. This should be fine to do because those credential sources are only initialized when certain hint checks are passed (i.e. existence of that relative URI ENV variable). |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
I'm attempting to use ECS TaskRoleArn to enable application access to AWS.
In looking at my container's Docker configuration I see
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
is set. Based on my reading of the guides I'm under the impression this should "just work".Expected Behavior
The SDK would authorize to AWS
Current Behavior
Reproduction Steps
taskRoleArn
Possible Solution
No response
Additional Information/Context
All gem versions:
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-sns (1.71.0) aws-sdk-core (3.191.0)
Environment details (Version of Ruby, OS environment)
public.ecr.aws/docker/library/ruby:3.2
The text was updated successfully, but these errors were encountered: