2012-01-06

Ghetto DNS

This is probably stupid, but…

I start my EC2 instance only when I need it but a while ago it was needed pretty often and figuring out the IP every time I wanted to SSH to the machine got annoying quickly.  Using the Dropbox Uploader bash script it was easy to set up a poor man's DNS since Amazon provides a way to figure out the public IP of an EC2 instance.

So by doing:
curl -s http://169.254.169.254/latest/meta-data/public-hostname
and using Dropbox Uploader one can put that result into a text file (say ec2-hostname.txt) in a Dropbox folder and use it in an SSH command as follows:
ssh -i your-amazon.pem username@`cat ~Dropbox/ec2-hostname.txt`
This solution had a certain gum and wire charm that I had to try it out but it only suffices for one man in his attic. If you want robust and scalable solution you'll need to use real DNS or Amazon's Elastic IP.

Labels: