Domain – Creating subdomains across multiple EC2 instances

amazon ec2domaindomain-name-systemnetworkingsubdomain

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

Best Answer

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)

Related Topic