Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Background : I have a domain, lets say example.com. I assign an elastic IP to a instance on EC2 and give it the dns name as example.com
I want to put 5 instances of EC2 under this domain, like so :
i1.example.com, i2.example.com,...

Question :

1 - is the above said possible ?
2 - if yes how to achieve it ? if no, whats the work around ?

Thanks

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Yes, it is possible.

For the single "example.com" server, you must use an elastic IP and assign the A record of example.com to that IP. This is due to the "zone apex" issue. https://forums.aws.amazon.com/thread.jspa?threadID=32044

For all other sub-domains, I recommend you use a CNAME from "i1.example.com" to the EC2-assigned domain name (e.g. "ec2-AA-BB-CC-DD.compute-1.amazonaws.com"). This method has two benefits:

  1. You do not exhaust your limit on elastic IPs http://aws.amazon.com/ec2/faqs/#Why_am_I_limited_to_5_Elastic_IP_addresses

  2. When referring to these systems, AWS EC2 DNS servers always report the correct IP - if it is being referenced externally it gives the external IP and if being used inside the EC2 cloud it gives the internal IP (no additional bandwidth cost)

share|improve this answer
    
Thanks for saying "it is possible" :) And +1 for the links And "Accepted" for the instructions on how to achieve it :) –  Shrinath Feb 17 '11 at 7:25

The easiest way is to use the other 4 elastic IPs and apply them to the i-N instances, in which case they'll just be additional DNS entries for those other IPs in your public DNS---no different from www.example.com.

A slightly less ugly version (but much more involved) method would be to run a reverse proxy that looks at the requests coming in and forwards them to the internal addresses of the i-N.example.com instances based on something identifiable at the application layer (e.g. HTTP vhost)

An uglier version would involve procuring a hosted + dynamic DNS service for example.com, and writing a startup script that would update the DNS for the i-N instances appropriately.

share|improve this answer
    
when "5" becomes "N", then we've a problem... we cant buy all the elastic ips in the Amazon farm, no ? :D –  Shrinath Feb 16 '11 at 6:19
    
Hence the proxy and DDNS alternatives :-P –  James Cape Feb 16 '11 at 12:49

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.