How do I assign the ELB (Elastic Load Balancer) to my domain. Do I need to do it for the main domain (ie. domain.com) or sub domain (www.domain.com). My registrar is godaddy - how I do it? - What's the most recommended way?
I also later want to redirect traffic from non-www to www (301 redirect via IIS) or vice versa and I need it to work.
If you're using AWS's Route53 with ELB this isn't a problem to point the
example.com
to an ELB CNAME record. Short of that it has to be done by a service rather than through DNS because of RFC 1034 section 3.6.2 paragraph 3 which reads:In other words it states that you can not have a CNAME RRset with any other RRset and a domain name record requires at a minimum 2 RRsets (SOA & NS) there by making it mutually exclusive with a CNAME RRset.
GoDaddy gets around this by offering domain
Forwarding
on their DomainManager details for the Domain Information. This updates the DNS record for your domain to point to one of their servers and it redirects the web-based domain requests to another URL. I utilize this for several domains that I have hosted with GoDaddy and running behind AWS ELBs. You just point the entry forwww.example.com
to your ELB CNAME RRset and then with the Forwarding in enable it'll be redirected as expected.To accomplish the same without using GoDaddy, you would have to have a host with a static IP, or EC2 instance with an EIP, running Apache or some other web server that could simply issue a 301 or 302 redirect back to
www.example.com
. I have also found that EasyDNS also offers a URL forwarding feature the appears to provide the same functionality as GoDaddy's but I have not had a chance to try it out.