So, you want to connect to an ec2 instance with bash? Well, I can show you how to do that (although google has plenty of places to provide you with better documentation and more features, I’m sure).
I have a billion functions on my host which sets up variables depending on what environment I’m in. So, you’ll need to take that into account. As a side note, this one is stupid simple, but I may as document it for myself later.
#!/bin/bash
instance_id=$1
instancename=$(ec2-describe-instances –show-empty-fields -K $awsKey -C $awsCert $instance_id | grep $instance_id | awk ‘/INSTANCE/{print $4}’)
echo “Connecting to $instance_id using $instancename”
ssh -i $keyLocation root@$instancename -o StrictHostKeyChecking=no
A real quick addendum to this post, before I push it out. I’m on my way to deploying an application that hasn’t been tested to production, because development failure. This is going to rock out with its cock out. ^_^
And boom goes the dynamite (sorry if I’ve put her up already, I can’t remember, and I am unable to find another pic right now):




