4

As I add more and more instances I'm increasingly annoyed that I keep having to log in to the console to find the IP I want.

Is there any way to set it up so that for example I can set the hostname of an EC2 server to "web-1" and then be able to ssh to "web-1" from anywhere inside of that VPC?

Preferably without me having to set up an EC2 instance to just host my own dns.

3

No, there is no easy way to do that. Amazon's VPC name servers do not support dynamic DNS. Here are some options:

  1. Run your own name server and enable DDNS (as you mentioned).
  2. Use a DNS provider (e.g., Route53, Dyn) that allows scripted updates and add an updating script as part of your instance provisioning process (e.g., using cloud-init under Linux).
  3. (Somewhat kludgy) Write a script that generates a /etc/hosts file via running ec2-describe-instances and then distribute it with you configuration management system.

Note you don't have to log into the web console to find out the IP. You can get it through command line tools or writing a (ruby, python, perl, etc) script using the AWS SDK. (Assuming Linux again.)

1
  • I'd just like to add that learning to not use host names for servers is a good idea. The network we have at work is small only about (20-30) servers but it just wouldn't make too much sense to start naming servers server01 server02 etc especially once you start doing auto scaling and everything. – bwight May 24 '14 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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