-
Notifications
You must be signed in to change notification settings - Fork 4.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
Support for AWS STS AssumeRole is required in the aws-cli docker image #6475
Comments
Hi @vinod827, Thanks for your post. The AWS CLI already supports this through named profiles. If you have a profile with a You can read more about this here: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html There is support for using a role ARN through an environment variable There is an open feature request to add support for |
Hi @kdaily, thanks for addressing my concern and also sharing this useful information. I have gone through with the AWS doc link and I must admit that I was looking for such a feature only which is already given out of the box by AWS for assuming a role. Thank you and really appreciated :) |
I agree with @vinod827. It's nearly impossible to do any sort of configuration when using the Docker image. There exists no Specifically, the
Yet, the command below still fails with docker run -it --rm \
-e AWS_PROFILE=${AWS_PROFILE} \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e ... \
amazon/aws-cli iam get-user This is made even worse because we can't run multiple commands with your Docker container (e.g. It is extremely important to fix this! That probably means fixing the FWIW: As it stands now, we have to make a whole bunch of hacky workarounds to deal with this in both:
run:
echo "bunchOfConfigStrings" > $HOME/.aws/credentials
docker run -v $HOME/.aws:/root/.aws ...
docker run -e ... --entrypoint bash amazon/aws-cli -c '
mkdir /root/.aws;
echo "[$AWS_PROFILE]" > /root/.aws/credentials;
(
unset AWS_PROFILE;
for envVar in $(compgen -v AWS); do
echo "$envVar ${!envVar}" | awk "{ printf \"%s = %s\n\", tolower(\$1), \$2 }";
done;
) >> /root/.aws/credentials;
aws iam get-user
' |
Hi @dPowNextdoor, Thanks for your comments. I'm not sure I follow though. A configuration and credential file are not required. The reason the command you supplied is failing is because you specified You can use the command
I can also mount my config file and override specific settings while getting the defaults, just as described in the documentation. For example, I can specify my access key and secret key, but get the region from the profile, which I set to
|
As a followup, I think this is the frustration you're experiencing. The docs on precedence state:
Unfortunately, for backwards compatibility, we cannot change how these environment variables interact, as explained in that issue here: #3304 (comment) |
Is your feature request related to a problem? Please describe.
I have written my own docker image using AmazonLinux:2 as base image and then customized that to have aws-cli library. I was passing the .aws credentials as a volume mount to that container so that it can used and to assume role using the AWS STS service.
Can we have similar thing in this aws-cli docker image, where by passing the .aws credentials as volume mount, I can assumerole and can get temporary credentials set.
This is my solution snippet in my customized docker image:-
In my dockerfile, I'm passing an assume-role.sh file where I'm trying to generate the temporary credentials using AWS STS assumerole by using the .aws credentials mounted as a volume to it.
So, the new feature request from my side is to have out of box capability of assuming a role by just passing AWS Role ARN while running the container where .aws credentials is mounted as a volume to the container in this aws-cli docker image as there are many use cases where this is a good fit.
Thank you
The text was updated successfully, but these errors were encountered: