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

AWS Config role_arn #345

Open
blischalk opened this issue Nov 16, 2017 · 2 comments
Open

AWS Config role_arn #345

blischalk opened this issue Nov 16, 2017 · 2 comments

Comments

@blischalk
Copy link

Does Amazonica support utilizing role_arn's from profiles within ~/.aws/config?

In my ~/.aws/config I have a role_arn in a profile declaration that lets me access the api of one account using access/secret keys from another account:

[default]
region = us-east-1
[profile foo]
role_arn = arn:aws:iam::58823005882300:role/Foobar
source_profile = default

From the command line I am able to specify a profile that I would like to utilize like below:

aws route53 list-hosted-zones-by-name --profile foo

This successfully fetches results.

I have tried passing the following combinations as credential maps to list-hosted-zones to attempt to leverage the arn defined within the profile in ~/.aws/config without any luck:

{:profile "foo"}
{:profile "arn:aws:iam::58823005882300:role/Foobar"}
{:role_arn "arn:aws:iam::58823005882300:role/Foobar"}
{:role "arn:aws:iam::58823005882300:role/Foobar"}
{:access-key "aws-access-key"
:secret-key "aws-secret-key"
:profile "arn:aws:iam::58823005882300:role/Foobar"}
{:access-key "aws-access-key"
:secret-key "aws-secret-key"
:profile "foo"})

If this is supported, what would the correct incantation be to leverage the role_arn from the profile in ~/.aws/config?

@mcohen01
Copy link
Owner

Theoretically this should be supported. And the incantation to choose the profile is passing a map as the first arg to any function, like you had, {:profile "foo"}. Whether or not it's actually supported via the Java SDK for this route 53 call, I don't know. I looked through the Java source and it looks like it is, but I can't really tell. You can prove that the profile key syntax works though pretty easy, if you want to.

@svend
Copy link
Contributor

svend commented Nov 17, 2017

There is an open issue with the Amazon Java SDK for ~/.aws/config support: aws/aws-sdk-java#803

I got around this by reading the role ARN from an environment variable then calling amazonica.aws.securitytoken/assume-role to get an access key.

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

No branches or pull requests

3 participants