MFA doesn't work as expected (fails or needs to be supplied every time)
- Dominant language
- Python
- Stars
- 7.3k
- Forks
- 780
- PR merge metrics
- No merged PRs in 30d
Description
I would like to use aws-shell, but we use roles with MFA authentication for all profiles. This breaks the commands that query aws and make other commands tedious to use.
my .aws/config file
```
[profile root]
output = json
region = eu-west-1
[profile account]
source_profile = root
role_arn = arn:aws:iam::ACCOUNT_ID:role/admin_role
mfa_serial = arn:aws:iam::ROOT_ACCOUNT_ID:mfa/ben
output = json
region = eu-west-1
```
.aws/credentials has the credentials for the root profile.
What happens (1): MFA is asked twice
```
$ aws-shell --profile account
aws> elasticbeanstalk list-available-solution-stacks
Enter MFA Code:
{} // Output skipped
aws> elasticbeanstalk list-available-solution-stacks
Enter MFA Code:
{} // Output skipped
```
What I expect to happen (1): MFA is asked once
```
$ aws-shell --profile account
aws> elasticbeanstalk list-available-solution-stacks
Enter MFA Code:
{} // Output skipped
aws> elasticbeanstalk list-available-solution-stacks
{} // Output skipped
```
What happens (2): Querying fails:
```
aws> ec2 start-instances --instance-ids
Enter MFA code:
Parameter validation failed:
Invalid length for parameter TokenCode, value: 0, valid range: 6-6
```
I think this may be okay if it wouldn't ask for MFA and wait with querying until you have authenticated.
What happens (3): Querying fails even after using MFA once
```
elasticbeanstalk list-available-solution-stacks
Enter MFA Code:
{} // Output skipped
aws> ec2 start-instances --instance-ids
Enter MFA code:
Parameter validation failed:
Invalid length for parameter TokenCode, value: 0, valid range: 6-6
```
Contributor guide
Assessment
This issue has not been assessed yet.