I’m looking at trying to clean up some of our service configurations, so that each stack can potentially run it’s own dedicated load balancer. I’m running in to inevitable port conflicts, and although I don’t think what I"m trying to do will be possible, I thought it worth asking the question on the off-chance that somebody has a clever solution!
I have Service A in a stack, which I want to serve with the domain a.example.com, over port 443 with SSL.
I have Service B in another stack, which I want to serve with the domain b.example.com, over port 443 with SSL.
I can configure a load balancer in one or other of the stacks, listening on port 443, with advanced routing redirecting to the appropriate service, based on hostname. I can also get this working with SSL configured.
This doesn’t scale well though. If I configure this load balancer in Service A’s stack, then maintenance on Service A stack can affect Service B. Also, I don’t think I can easily configure more than two SSL certificates.
I could configure the load balancer entirely in it’s own stack, but that means there’s more decoupling than I’d like (and also doesn’t solve the scaling of the SSL config). Is there a clever way I can configure Service A and Service B, so that they have their own load balancers configured to listen on the same port, but for different domains?