Skip to content

Conversation

@hkobayash
Copy link
Contributor

Summary

  • Implemented MFA (Multi-Factor Authentication) support for AWS profiles
  • Resolves authentication errors when using profiles with mfa_serial configured
  • Adds interactive MFA token prompt when authentication requires it

Problem

When using an AWS profile with MFA enabled (configured with mfa_serial in ~/.aws/config), the tool would fail with:

Failed to load AWS configuration: assume role with MFA enabled, but AssumeRoleTokenProvider session option not set

Solution

  • Added InteractiveMFATokenProvider function to prompt users for MFA tokens
  • Configured AWS SDK with WithAssumeRoleCredentialOptions to use the MFA token provider
  • Updated dependencies to include stscreds for handling STS AssumeRole operations

Changes

  • pkg/awsutils/client.go: Added MFA token provider and configured AWS SDK to use it
  • go.mod: Added required credentials dependency
  • README.md: Added documentation for MFA support with configuration examples

Test Plan

  • Test with standard AWS profile (no MFA)
  • Test with MFA-enabled profile - should prompt for token
  • Verify token generation works after MFA authentication
  • Confirm documentation is clear and examples work

- Implement interactive MFA token provider that prompts for token input
- Configure AWS SDK to use MFA token provider for AssumeRole operations
- Add stscreds dependency for handling STS assume role with MFA
- Document MFA support in README with configuration examples

Fixes the error: "assume role with MFA enabled, but AssumeRoleTokenProvider session option not set"
@hkobayash hkobayash merged commit 902da46 into main Sep 2, 2025
@hkobayash hkobayash deleted the feat/mfa-support branch September 2, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants