Skip to content

Instantly share code, notes, and snippets.

@sgdan
sgdan / awslogin
Last active August 24, 2019 15:12
Utility shell script for logging into AWS CLI named profile using an MFA token
#!/bin/bash
if [ $# -lt 1 ]; then
cat << EOF
usage: awslogin <profile>
Utility script for logging into AWS CLI named profile with an MFA token.
A session token will be requested and the "default" profile will be updated
with the valid session data. Make sure you have a named profile configured
as described below, including the "mfa" arn: