Skip to content

Instantly share code, notes, and snippets.

@radnov
radnov / aws-mfa.sh
Created June 23, 2021 17:00
aws-cli MFA helper
#!/usr/bin/env bash
tempcreds_file="$HOME/.aws/tempcreds"
device="" # <- MFA DEVICE ARN HERE
key_env="AWS_ACCESS_KEY_ID"
secret_env="AWS_SECRET_ACCESS_KEY"
token_env="AWS_SESSION_TOKEN"
duration=3600
export_env_vars () {