Skip to content
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

Add a dynamic role route to ECS server #878

Merged
merged 2 commits into from
Mar 8, 2022
Merged

Conversation

mtibben
Copy link
Member

@mtibben mtibben commented Mar 8, 2022

Adds a new route to aws-vault exec --ecs-server to assume role credentials dynamically.

The ECS server now responds to requests on /role-arn/YOUR_ROLE_ARN with the role credentials, making it usable with the AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment
variables. These environment variables are used by the AWS SDKs as part of the default credential provider chain.

The major use-case for this are applications that may wish to assume a role dynamically, without the role specified in the aws config file.

In particular, this is designed to allow aws-vault to run on your local host while docker images access role credentials dynamically. This is achieved via a reverse-proxy container (started with aws-vault exec --ecs-server --lazy PROFILE -- docker-compose up ...) using the default ECS IP address 169.254.170.2. Docker containers no longer need AWS keys at all - instead they can specify the role they want to assume with AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.

Screen Shot 2022-03-03 at 12 16 15 pm

This use-case is similar to the goal of amazon-ecs-local-container-endpoints, however the difference here is that the long-lived AWS credentials are getting sourced from your keychain via aws-vault.

A --lazy flag has also been added so that credentials are only retrieved when a request is actually made to the server.

@mtibben mtibben merged commit d1c30c3 into master Mar 8, 2022
@mtibben mtibben deleted the ecs-server-role-route branch March 8, 2022 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant