Skip to content

Instantly share code, notes, and snippets.

@j3tm0t0
Created April 10, 2013 15:55
Show Gist options
  • Select an option

  • Save j3tm0t0/5355904 to your computer and use it in GitHub Desktop.

Select an option

Save j3tm0t0/5355904 to your computer and use it in GitHub Desktop.
ec2ssh
function ec2ssh
{
instance=$1
host=`ec2-describe-instances $1 | grep ^INSTANCE | cut -f 4`
if [ "$host" = "" ]
then
host=`ec2-describe-instances $1 | grep ^INSTANCE | cut -f 17`
fi
if [ "$host" = "" ]
then
host=`ec2-describe-instances $1 | grep ^INSTANCE | cut -f 18`
fi
ssh -o "StrictHostKeyChecking no" ec2-user@$host $2 $3 $4 $5 $5 $6 $7 $8 $9
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment