HackerTrans
TopNewTrendsCommentsPastAskShowJobs

simzor

no profile record

Submissions

Six European Boostrapped Startups

sifted.eu
1 points·by simzor·4 tahun yang lalu·0 comments

GitHub Having Issues

githubstatus.com
79 points·by simzor·5 tahun yang lalu·41 comments

comments

simzor
·4 tahun yang lalu·discuss
Thank you!!
simzor
·4 tahun yang lalu·discuss
Makes operating AWS CLI against a user with MFA enabled easier

---------

#!/bin/sh

echo "Store and retrieve session token AWS STS \n\n"

# Get source profile read -p "Source Profile [<profile_name>]: " source_profile source_profile=${source_profile:-'<profile_name>'} echo $source_profile

# Get destination profile read -p "Destination Profile [<profile_name>-mfa]: " destination_profile destination_profile=${destination_profile:-'<profile_name>-mfa'} echo $destination_profile

mfa_serial_number='arn:aws:iam::<id>:mfa/<name>'

echo "\nOTP: " read -p "One Time Password (OTP): " otp

echo "\nOTP:" $otp echo "\n"

output=$(aws sts get-session-token --profile <profile_name> --serial-number $mfa_serial_number --output json --token-code $otp)

echo $output

access_key_id=$(echo $output | jq .Credentials.AccessKeyId | tr -d '"') secret_access_key=$(echo $output | jq .Credentials.SecretAccessKey | tr -d '"') session_token=$(echo $output | jq .Credentials.SessionToken | tr -d '"')

aws configure set aws_access_key_id $access_key_id --profile=$destination_profile aws configure set aws_secret_access_key $secret_access_key --profile=$destination_profile aws configure set aws_session_token $session_token --profile=$destination_profile

echo "Configured AWS for profile" $destination_profile
simzor
·5 tahun yang lalu·discuss
Haha. To be fair GitHub has had a lot of issues that last few months though.