npm i --location=global @20i/aws-profile-scripts
# view usage entry
npx aws-mfa -h
This command helps you to authenticate with AWS using MFA and store the temporary credentials in your AWS profile.
- Run
npx aws-mfa -p myproject
- Enter your six-digit code when asked for your authenticator token.
You may be asked to configure your myproject-mfa
profile. It should be configured to use the access key and secret from your IAM user in AWS.
If you're logging in with SSO, rather than an access token, this script just adds a fast way to update your profile, but it still requires copying and pasting the SSO credential information.
# view usage entry
npx add-aws-profile --help
Instructions:
- Open your SSO link, such as: https://twentyideas.awsapps.com/start/
- Click on the project you want to authenticate with
- Select "Command line or programmatic access"
- Copy the text under "Option 2: Add a profile to your AWS credentials file"
- Run
add-aws-profile <profileName>
with<profileName>
as the profile you want to add or replace - Paste in the profile you copied
This will add the profile to your ~/.aws/credentials
file, and create a backup of the file.