EC2 Launching
Everyday I launch a lot of EC2 instances as part of a controlled process:
- deploying an application in the Engine Yard Cloud Dashboard
- using the EC2 plugin for the knife cli tool for Opscode Chef
I also wind up running a lot of ad-hoc instances for quick experiments. This required a frustrating multi-step dance:
ec2-run-instances
- highlight and copy the Instance ID
- wait long enough that networking is provisioned
ec2-describe-instances
with the pasted id- highlight and copy the Public DNS attribute
- wait long enough that sshd will be available before the connection times out
ssh -oForwardAgent=yes -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -i ~/.ec2/keypair.pem
with the pasted hostname
Last week I got to the breaking point during one of these cycles and hacked
together a script to launch and log into these one-off instances. The
helpful tcp_test_ssh
and wait_for_sshd
methods are grabbed mostly verbatim
from the previously mentioned knife-ec2 plugin.