-
Make an
$HOME/.aws/credentials
file:[default] aws_access_key_id = <your accesskeyid> aws_secret_access_key = <your secret access key> region = us-east-2
-
Install AWS cli
brew install awscli
-
Check AWS cli
aws sts get-caller-identity
You should see your username
-
Create ssh keys for AWS region you plan to use
REGION=us-east-2 KEYNAME=judd-ocpworkshop openssl genrsa -out ~/.ssh/${KEYNAME}.pem 2048 openssl rsa -in ~/.ssh/${KEYNAME}.pem -pubout > ~/.ssh/${KEYNAME}.pub chmod 400 ~/.ssh/${KEYNAME}.pub chmod 400 ~/.ssh/${KEYNAME}.pem touch ~/.ssh/config chmod 600 ~/.ssh/config aws ec2 import-key-pair --key-name ${KEYNAME} --region=$REGION --output=text --public-key-material "`cat ~/.ssh/${KEYNAME}.pub | grep -v PUBLIC`"
-
If necessary, add other regions
REGIONS="ap-southeast-1 ap-southeast-2 OTHER_REGIONS..." for REGION in `echo ${REGIONS}` ; do aws ec2 import-key-pair --key-name ${KEYNAME} --region=$REGION --output=text --public-key-material "`cat ~/.ssh/${KEYNAME}.pub | grep -v PUBLIC`" done