Load Balancing in Amazon EC2 with multiple CNAME
My portal have multiple cname record, all point to same server. Like aaa.com, bbb.com and alson *.abc.com. I need this url in my web application to give proper content.
Now I want move Amazon Load Balancing.
- How about my all cname records? Is there any road blocks?
- When I use load balancer the user entered url aaa.com will posted to server or load balancer dns will posted to server?
- Finally, is there any good articles about amazon load balancer.
Solution 1:
Elastic Load Balancing gives you a CNAME as an endpoint. Here's an example:
$ host www.foursquare.com
www.foursquare.com is an alias for star-foursquare-com-367497865.us-east-1.elb.amazonaws.com.
As you can see, ELB works by providing a .wherever.elb.amazonaws.com
domain name, with a low TTL. Amazon will then return you different DNS values for the ELB based on where you are coming from, and what backend servers are up. (I wrote a blog post on this topic once which I encourage you to read if you want more detail.)
So, you can make site.abc.com
or even *.abc.com
a CNAME to your .wherever.elb.amazonaws.com
address, and the name will be forwarded to the instances behind it as you would expect.
aaa.com is trickier, as the zone apex (root name) cannot generally be a CNAME. The previous workaround was to point aaa.com to a single EC2 instance on an elastic IP, which you would re-map in the case of failure; however, Amazon recently released an addition to their Route 53 DNS service where they will set keep the DNS records for aaa.com in sync with what your ELB CNAME will return.
Solution 2:
It should work fine with CNAME records. The browser simply keeps resolving until it gets an IP address answer, then sends a HTTP request with a Host header to that IP. AWS load balancers will just pass the Host header to the back-end webservers, which gives you regular Name-based virtual hosting functionality that you already use.
About good articles, have you tried Google? I'm kidding, but that question is far to general. Amazon has good articles and there are plenty of articles online.