-
Notifications
You must be signed in to change notification settings - Fork 325
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 use AWS ECS task role credentials #956
Comments
Is the value ``/v2/credentials/54da6c7a-84ff-41dc-a160-21b8a8bc7fb0
It looks like ECS role is different than IAM. In that case, we may need to have different provider like IAM provider. |
@balamurugana I was just giving an example value for I searched this org, and this is already implemented in golang: https://github.com/minio/minio-go/blob/f0e2f3ae36786e5e69f34fdaff106223ddba6082/pkg/credentials/iam_aws.go#L113 Also ECS task role is treated the same as IAM instance roles. Pretty much every single AWS SDK will automatically use it as a default if So that needs to be ported over to python. I can take a stab at it this week. |
The more I look at it, the more this seems like it can become a breaking change if I try to keep with the same Right now, the code takes For ECS, this step is not needed: i.e. you would just use the url like I can test If a user has not defined an endpoint, then I can make these changes just fine. However, if they have defined an I can get around this 2 ways:
Do you think 1 or 2 (or some other way) is better? From your last comment it seems you could support either the optional argument or the new provider. |
IAM provider source code:
minio-py/minio/credentials/providers.py
Line 187 in 1ee647e
The issue is that
creds_path = "/latest/meta-data/iam/security-credentials"
is hardcoded.On an EC2 instance, you can run
curl http://169.254.169.2data/iam/security-credentials
to get the iam role, thencurl http://169.254.169.2data/iam/security-credentials/ROLENAME
to get the credentials.For an ECS task running with a task iam role on an ec2 instance, you can get credentials if you run
curl 169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
. The value forAWS_CONTAINER_CREDENTIALS_RELATIVE_URI
is typically like:/v2/credentials/54da6c7a-84ff-41dc-a160-21b8a8bc7fb0
. The provider lets you setendpoint
, but sincecreds_path
is hardcoded, I cannot get the credentials.Also, the logic for "Get credentials of first role." is not required in the ECS task method.
I suspect a fix would involve either making
creds_path
also configurable (and also the logic to get the first role, since it directly gives the credentials), or checking ifAWS_CONTAINER_CREDENTIALS_RELATIVE_URI
is present in the environment variables and changing behavior accordingly.Example results from
curl 169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
:The text was updated successfully, but these errors were encountered: