Skip to content

Instantly share code, notes, and snippets.

@geekgunda
geekgunda / aws-mfa-access.sh
Last active March 18, 2024 14:33
aws-cli MFA access via assume role
#!/bin/bash
# Assumption:
# 1. Your original AWS Creds should be stored at ~/.aws/credentials
# 2. You've corrected ARN for MFA device (search for FIXME)
# 3. You've given correct MFA Code as cli argument
# 4. You have jq installed. Ref: https://stedolan.github.io/jq/
if [ "$1" == "" ]; then
echo "Usage: `basename "$0"` <MFA-TOKEN>"
exit