boltops-tools / boltops-tools/aws-mfa-secure

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

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
25
Forks
5
PR merge metrics
No merged PRs in 30d

Description

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/

```

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:

```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the shown `aws --profile profile123 s3 ls` and `AWS_PROFILE=profile123 aws s3 ls` commands, then trace how aws-mfa-secure handles the `--profile` flag versus the environment variable. Done means both forms request MFA as needed and successfully list the bucket contents.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, ruby
Domain
authentication, cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.