AWS commands easy to manipulate on terminal
$ brew tap tilfin/aws
A script to ssh EC2 instances to be selected from the list shown for specified profile
$ brew install ec2ssh
$ ec2ssh <aws profile>
Enter MFA code>
is shown.~/.ec2ssh-pre
file.~/.ec2ssh-post
file.bastion
in pre hookcase $profile in
brand-x)
bastion=brand-x-bastion
;;
brand-y)
sudo route add 50.200.200.100 192.168.50.1
;;
esac
case $profile in
brand-y)
sudo route del 50.200.200.100
;;
esac
A script to switch an assume role for terminal shell
$ brew install swrole
$ swrole [-j] [-o] [-t <OTP>] <aws_profile>
-j
: Output JSON for AWS credential_process.-o
: Output AWS credentials values as environment variable definitions.-t <onetime_code>
: Specify a onetime code, e.g., -t 123456
.-o
nor -j
option is specified.Add the following fields to ~/.aws/config
:
color
: Specify a color for the profile name in the forked bash.generate_token
: Automatically obtain OTP by executing the specified command for profiles with mfa_serial
defined.