You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to compliance/regulatory requirements, some organizations enforce the requirement that programmatic access to AWS APIs use Multi-Factor Authentication (MFA). With the AWS Command Line Interface (AWS CLI), users are automatically prompted to provide their MFA token when making API calls. New session credentials are generated by AWS Security Token Service (AWS STS) and cached locally. The user is then prompted again when the credentials have expired. Currently, knife-ec2 does not "bubble up" this token request, instead failing with the following (having specified knife[:aws_config_file] and knife[:aws_profile] in knife.rb).
$ knife ec2 server create -r 'role[testrole]' -I ami-0080e4c5bc078760e -f t2.micro --ssh-key my_key
ERROR: You did not provide a valid 'AWS Access Key Id' value.
ERROR: You did not provide a valid 'AWS Secret Access Key' value.
Steps to Reproduce:
Create a new AWS Identity and Access Management (AWS IAM) user.
Configure MFA for the user.
Create a role that can be assumed by said user.
Add this user as a new profile in ~/.aws/config.
Add a second profile for the role to be assumed, using the user profile as source_profile.
Update knife.rb to include knife[:aws_config_file] and knife[:aws_profile].
Specify the role profile as knife[:aws_profile] (not the user profile).
Attempt to run a command such as knife ec2 create.
The AWS credentials configuration file should information similar to the following:
On the final step, the user should be prompted for their MFA token. This is in line with the result of running a similar AWS CLI command.
$ aws ec2 describe-instances --profile roleprofile
Enter MFA code for arn:aws:iam::123456789012:mfa/mfauser:
Actual Result:
See below output:
$ knife ec2 server create -r 'role[testrole]' -I ami-0080e4c5bc078760e -f t2.micro --ssh-key my_key
ERROR: You did not provide a valid 'AWS Access Key Id' value.
ERROR: You did not provide a valid 'AWS Secret Access Key' value.
The text was updated successfully, but these errors were encountered:
Version:
0.9.16
Environment:
OS: macOS 10.14
Ruby: 2.3.0p0
ChefDK: 3.8.14
Scenario:
Due to compliance/regulatory requirements, some organizations enforce the requirement that programmatic access to AWS APIs use Multi-Factor Authentication (MFA). With the AWS Command Line Interface (AWS CLI), users are automatically prompted to provide their MFA token when making API calls. New session credentials are generated by AWS Security Token Service (AWS STS) and cached locally. The user is then prompted again when the credentials have expired. Currently,
knife-ec2
does not "bubble up" this token request, instead failing with the following (having specifiedknife[:aws_config_file]
andknife[:aws_profile]
inknife.rb
).Steps to Reproduce:
~/.aws/config
.source_profile
.knife.rb
to includeknife[:aws_config_file]
andknife[:aws_profile]
.knife[:aws_profile]
(not the user profile).knife ec2 create
.The AWS credentials configuration file should information similar to the following:
Expected Result:
On the final step, the user should be prompted for their MFA token. This is in line with the result of running a similar AWS CLI command.
$ aws ec2 describe-instances --profile roleprofile Enter MFA code for arn:aws:iam::123456789012:mfa/mfauser:
Actual Result:
See below output:
The text was updated successfully, but these errors were encountered: