Skip to content

Instantly share code, notes, and snippets.

View ashishjullia's full-sized avatar
💻
Exploring

Ashish Jullia ashishjullia

💻
Exploring
View GitHub Profile
@ashishjullia
ashishjullia / aws-mfa-access.sh
Last active June 6, 2024 06:39 — forked from geekgunda/aws-mfa-access.sh
aws-cli MFA access via assume role
#!/bin/bash
if [ "$1" == "" ]; then
echo "Usage: $(basename "$0") <MFA-TOKEN>"
exit 1
fi
session_duration=129600 # 36 hours
mfa_device_code=$(aws iam list-mfa-devices | jq -r .MFADevices[0].SerialNumber)
if [ -z "$mfa_device_code" ]; then