Closed dgholz closed 1 year ago
Switching the command to the new aws-vault export --format=json my-shared-base-profile
didn't change the behaviour, nor did using --no-session
(with exec
and with export
)
I'm facing the same problem today. I ran brew update && brew upgrade
this morning and now aws-cli commands no longer work - I also use credential_process
on my profiles (in ~/.aws/config
).
A simple aws --profile MYPROFILE s3 ls
(or using aws-vault
directly) takes various minutes to show the following error:
aws-vault: error: exec: Failed to get credentials for MYPROFILE: running command "aws-vault exec MYPROFILE --json --no-session": exit status 1
Removing the credential_process
fixes the issue, but unfortunately I depend on credential_process
for other reasons.
[profile my-shared-base-profile] credential_process=aws-vault exec my-shared-base-role -j
@dgholz your config doesn't show any [profile my-shared-base-role]
as is referred to in your credential_process. Can you provide it?
What does running aws-vault exec my-shared-base-role -j
yourself give you?
I see this use case documented in USAGE.md, and I can't see how what I'm doing differs. Is this still working?
Where in USAGE do you see this?
@dgholz your config doesn't show any
[profile my-shared-base-role]
as is referred to in your credential_process. Can you provide it?
typo when redacting, should have been my-shared-base-profile
. I updated the config I shared in the original post.
Where in USAGE do you see this?
@dgholz I believe what you want is something like this for v7:
[profile base]
mfa_serial=arn:aws:iam::121212121212:mfa/myusername
region=eu-west-1
[profile base-session]
credential_process=sh -c 'aws-vault --prompt terminal export base --duration 12h --format=json 2> $(tty)'
[profile somerole]
role_arn=arn:aws:iam::242424242424:role/cross-account-role
source_profile=base-session
This works for me (and my team) on different platforms and allows the MFA credentials to be cached. If I understand correctly, somerole
invokes base-session
, which invokes aws-vault
through credential_process
and exports the base
profile. The tty
redirect trick is to ensure things like Terraform pick it up and prompt for the MFA challenge when needed.
I do end up with a duplicate session at the moment when aws-vault
is invoked through the SDK (e.g. by calling aws --profile somerole s3 ls
):
Profile Credentials Sessions
======= =========== ========
base base sts.GetSessionToken:7h24m21s
base-session - credential_process:7h24m21s
but that should be fixed by whatever is decided in https://github.com/99designs/aws-vault/issues/1181. With v6 I would just get the sts.GetSessionToken
, which is what I expect we'll get back once the new credential_process
name overload part can be disabled.
Thanks, that is exactly the approach we're taking.
A pre-release fix has been released v7.0.2-beta2 release. Can you please test this and confirm that it fixes this issue
I had this same issue and v7.0.2-beta2 release fixed it.
.aws/config
(redacted if necessary)aws-vault --debug
(redacted if necessary)I've tried the new release and can't use profiles that assume roles.
My config:
I ran
aws-vault clear
to drop any active sessions. After than,aws-vault
seems to hang when trying to use it to get the credentials:I can get it to work by logging in with a previous version of
aws-vault
first & not clearing the session.I can also get it to work by removing the
credentials_process
line from themy-shared-base-profile
, but then I can't useAWS_PROFILE
oraws --profile
:I see this use case documented in USAGE.md, and I can't see how what I'm doing differs. Is this still working?