Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to use an ec2 instance just to do work on some personal programming and text processing projects in the cloud (from an ssh terminal) rather than on a desktop. I don't always need access to the instance, so I want to stop the instance whenever I don't need to work. However, when I restart the instance, the public dns has changed and I have to recopy the dns to my ssh command to gain access to the instance.

Is there a free way to make the public dns for such an ec2 instance fixed?

share|improve this question

2 Answers 2

I doubt you can change the way Amazon works, but you could have more than one DNS name. Sign up for a free dynamic DNS account and create a DNS A record (host record). Then download, and install the stub app that updates your new hostname's IP address.

http://www.dyndns.com/services/dns/dyndns/ (sign-up for account)

http://www.dyndns.com/support/clients/ (client to load to update your DDNS)

share|improve this answer
    
P.S. I have used their DDNS for my personal mail server for about 5 years, and it has never failed me. As soon as my IP changes, it is updated immediately, although I use my firewall to do the updating, not the stub app. –  KCotreau Jul 19 '11 at 5:09
    
Are you suggesting running dyndns from the instance? Is it possible to update the dns record from the instance automatically when it's started (sorry if this is a dumb question. I'm an ec2 n00b.) –  jonderry Jul 19 '11 at 5:18
    
That is exactly what I am saying. You do plan on saving the instance, right? With certain things installed on it all the time (including the DDNS app)? It seems to me like this would work. –  KCotreau Jul 19 '11 at 5:19
    
For the record, I am also not very versed in ec2, but I do know DNS, and networking, so if you can save the instance (and I know you can somehow, whether you have to buy storage or whatever), it will work. –  KCotreau Jul 19 '11 at 5:21
    
OK, I'll see if I can get this to work tomorrow, and yes, I save the instance. Everything is stored in EBS when the instance is stopped. The only question is whether I can run dyndns or something similar automatically I guess. –  jonderry Jul 19 '11 at 6:12

I've been looking into a similar setup, using a dynamic DNS service to save myself from having to copy out the IP address of the instance every time I start it. I've come across a script for afraid.org (a free [as in beer] dynamic DNS service), which can be run on startup to have the DNS updated with the instances new IP address:

http://helmingstay.blogspot.com/p/afraidorg-script-for-amazon-ec2.html

To be honest, I haven't tried this script yet because it's a tiny bit intimidating considering I haven't even launched an instance yet, but if anyone successfully implements this method I'd love to hear about it. I'd also love to hear about how difficult it is to save the instance in between starting up and shutting down! (I know there's plenty of reading on this matter, but the SE community just explains things so much better!) Thanks in advance and hope this helps.

share|improve this answer
    
Just a quick update: I've now set up an instance for development (running ubuntu), and have successfully implemented/tested this script. Works like a charm so far; just need to see how it handles over time, but I don't foresee any issues. –  Cory W. Feb 13 '13 at 17:33
    
could you share some details? do you run it from cron, how often? Or from /etc/rc.local at startup? What is the behavior when the instance is stopped and started later, with a new IP, how much time the DNS update takes? Thanks! –  eudoxos Jul 29 at 9:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.