Created
August 6, 2016 03:27
-
-
Save avshabanov/28d12a894b7f1298ae8ac99e3a2b7d74 to your computer and use it in GitHub Desktop.
AWS Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/bin/bash | |
# Easy-to-use access to AWS EC2 - e.g. sshawsn.sh test 1 | |
# hosts.txt - contains ec2 public DNS records | |
PEM_FILE=$HOME/opt/config/aws/$1.pem | |
if [ ! -f $PEM_FILE ]; then | |
echo "Non-existent pem file: $PEM_FILE" | |
exit -1 | |
fi | |
HOST_FILE=$HOME/opt/config/aws/hosts.txt | |
HOST=`sed "$2q;d" $HOST_FILE` | |
if [ -z "$HOST" ]; then | |
echo "Invalid host number" | |
exit -1 | |
fi | |
echo "Logging in to $HOST" | |
ssh -i $PEM_FILE $HOST -l ec2-user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment