A [ba|z]sh function to fetch temporary access credentials for awscli
Inspired by this 'ogavrisevs' gist
awscli
(and configuredconfig
,credentials
files)- Working AWS account MFA and the device ARN
awk
- Paste this code in
~/.profile
,.zshrc
, ... - or, make a file out of it, e.g.
~/.awsmfa
and in.profile
-ishsource
from profile, rc - Update lines 9,10,11 with your info and desired settings
after defining the function:
bash-5.2$ awsmfa
MFA Code: 712717
bash-5.2$ aws ec2 describe-vpcs | jq -r '.Vpcs[] | [.VpcId, .CidrBlock] | @tsv'
vpc-05f640d1978a16de0 172.31.0.0/16
vpc-076a8e5660e066e69 192.168.0.0/16