Multiple domain names attached to same load balancer as alias records?

13,391

Yes, you can.

However, you need to keep the following considerations in mind, depending on what your application requires:

  • ELB forwards the Host: header to the instance; it doesn't interpret it, so your web servers are responsible for reacting to the Host: header in the incoming request, and handling each site appropriately.

  • ELB will load balance all the requests among all of the instances, regardless of which domain they are for, since it doesn't know (or care).

  • ELB can only serve up a single SSL certificate. If you are using SSL, you have to have exactly one cert that's valid for all of the domain names, or, you have to run the ELB listener in transparent (TCP, not HTTPS) mode and handle the SSL certs with SNI on the instances, themselves. If you can't meet this constraint, you need one ELB per SSL cert, so the original question is moot -- each ELB has its own target for use with aliases.

Share:
13,391
Zeni
Author by

Zeni

I am a graduate mechanical engineer and have worked as one for many many years. some years back I developed deep interest in IoT and web. Now I am working on my own IoT project ideas. Due to this now I have good knowledge of nodejs, html, css, mysql, MS sql server, C language, C++, AWS technologies, ESP-IDF. In my own time I have explored so many other things including Inventor, AutoCad, CADWorx, Catia, C#, 3DMax, Maya, Photoshop, Aftereffects etc. Wish to be part of some good team.

Updated on June 14, 2022

Comments

  • Zeni
    Zeni about 2 years

    I have hosted multiple domain names (example.com and example.net ) on same instance in my auto scaling group. Now I have attached this auto scaling group to a load balancer. Using Route 53 can I point two zone apex (such as example.com and example.net) to same load balancer as alias records?

  • Zeni
    Zeni over 9 years
    Thanks. 1 What should be the ping path in case of multiple domains.( because' if ELB could not find specified health check page, it does not send traffic to that instance.) 2. If l use SSL with only one domain, then listener in https mode would be ok?
  • Michael - sqlbot
    Michael - sqlbot over 9 years
    @Zeni if you only have one domain with SSL, the others will work fine through a single ELB on http; if someone hits it on https with one of the other domains, they will connect but get an invalid certificate warning. The "ping" test from ELB should have its Host: header set to the individual instance's IP address, and will have a User-Agent: containing the string "ELB". You can confirm this behavior in the server logs and respond accordingly.
  • r3m0t
    r3m0t about 7 years
    ELB now added the ability to route between instances based on the Host header.