Skip to content

Instantly share code, notes, and snippets.

View zakolenko's full-sized avatar

Roman Zakolenko zakolenko

View GitHub Profile
@zakolenko
zakolenko / aws-mfa-cli.sh
Last active February 9, 2020 21:03
Bash function that authenticates access to AWS resources through the AWS CLI using MFA token
#!/bin/bash
# Prerequisites:
# 1. jq (command-line JSON processor) - https://stedolan.github.io/jq/
# 2. function args:
# - arn-of-the-mfa-device (first arg)
# - code-from-token (second arg)
aws_mfa_cli () {
unset AWS_ACCESS_KEY_ID