aws-mfa-secure icon indicating copy to clipboard operation
aws-mfa-secure copied to clipboard

commands do not work with `--profile` different from the default one

Open pyrocks opened this issue 2 years ago • 0 comments

Hi,

I was having difficulties making the wrapper work while specifying a different profile using the --profile flag the following commands were all issued in quick succession

~/somefolder > which aws
aws: aliased to aws-mfa-secure session

no profile - working - I already entered my mfa token earlier today, default profile is not profile123:

~/somefolder > aws s3 ls s3://some-bucket-name/
<list of files returned>

with --profile - not working

~/somefolder > aws --profile profile123 s3 ls s3://some-bucket-name/

An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied

export AWS_PROFILE instead of --profile - now it's working - notice requesting the MFA code which --profile didn't

~/somefolder > export AWS_PROFILE=profile123
~/somefolder > aws s3 ls s3://some-bucket-name/
Please provide your MFA code: <code entered>
<list of files returned>

even after doing this - --profile still doesn't work and I get the same error.

pyrocks avatar Jul 19 '22 12:07 pyrocks