trek10inc / awsume

A utility for easily assuming AWS IAM roles from the command line.
https://awsu.me
MIT License
487 stars 90 forks source link

Can't add credentials into environment vars #156

Closed AzySir closed 3 years ago

AzySir commented 3 years ago

Not sure if I'm misusing awsume....

When I run awsume <profile> nothing is being added into my env variables. When I run aws sts get-caller-identity the result has the IAM User rather than the role.

~/.aws/config

[profile my_profile]
role_arn = arn:aws:iam::123456789999:role/my_role
source_profile = default

~/.aws/credentials

[default]
aws_access_key_id = AKIA****
aws_secret_access_key = ****

Executed Command

awsume my_profile
[my_profile] Role credentials will expire 2021-05-16 03:22:59

The below command works as intended, this is what's confusing me.

Show Commands

awsume -s my_profile
export AWS_ACCESS_KEY_ID=ASIA*** (works)
export AWS_SECRET_ACCESS_KEY=*** (works)
export AWS_SESSION_TOKEN=*** (works)
export AWS_REGION=eu-west-1
export AWS_DEFAULT_REGION=eu-west-1
export AWSUME_PROFILE=my_profile
export AWSUME_EXPIRATION=2021-05-16T03:25:21
andymac4182 commented 3 years ago

Have you added in the alias?

I see the same experience when I forgot to add in the alias.

A quick way to check is to run the command that the alias uses under the covers eg. . awsume my_profile

AzySir commented 3 years ago

@andymac4182 thank you my good sir! That fixed it!