Managing Many External Hosts Using EC2 and Route 53
Posted
by
futureal
on Server Fault
See other posts from Server Fault
or by futureal
Published on 2012-06-09T23:35:53Z
Indexed on
2012/06/10
4:42 UTC
Read the original article
Hit count: 560
Looking for a "best practice" answer to managing externally-addressable hosts using the combination of Amazon EC2 and Amazon Route 53, without using Elastic IPs for each host. In my scenario I will have 30+ hosts that need to be accessible from outside EC2, so directly using internal DNS will not work.
In the past, I have addressed hosts by assigning an elastic IP to that host (let's say, 55.55.55.55) and then creating an associated A record. For example, let's say I want to create "ec2-corp01.mydomain.com" I might do:
ec2-corp01.mydomain.com. A 55.55.55.55 300
Then on that EC2 instance, I would assign the Elastic IP of 55.55.55.55, and everything works fine. Of course, to make this work, I need to have one Elastic IP per instance, which is something I'd like to avoid if possible; I'd like the infrastructure to be more dynamic.
So my thought is to try something like:
Create a script that queries the internal EC2 tools to determine an instance's private hostname
On instance boot, call that script to determine its hostname, and then using the command-line Route 53 interface to find and update that hostname to its current internal hostname
Since the host will have a relatively low TTL (let's say 300 as above, or 5 minutes) it should take effect pretty quickly
Is this a good idea? Is there a better or more widely accepted way to handle it?
If it IS a good idea, what type of record should I be creating? A CNAME that points to the internal host, like ec2-55-55-55-55.compute-1.amazonaws.com? Is an A record better or worse?
Thanks!
© Server Fault or respective owner