Search code examples
amazon-web-servicesamazon-ec2amazon-elbelastic-load-balancer

can AWS Classic ELB (VPC) be used to serve content from 2 different services by configuring listeners to different ports


I have 2 different web services which are hosted in some EC2 instances . I want to put them behind a single ELB and based on the port mapping redirect the request to the 2 services . For ex - Web Service A is exposed on port 8080 and WebService B is exposed on port 8081 . Listeners are like this

            For Webservice A

 Load Balancer Port - 443 , Instance Port - 8080

          For WebService B 

  Load Balancer Port - 444 , Instance Port - 8081

I m seeing the response is being fetched but sometimes , I get time out error . Is it anything to do with my configuration of ELB ? ELB logs unfortunately do not give much clarity on this as they seem to forward always to the right instance but no of requests I make and no of lines of entries in logs are not equal .


Solution

  • ELB would have only one healthcheck and verify the status based on that for both the instances. Assuming you are using healthcheck over port 80 and both instances are listening on port 80.

    When there is a request from port 443 it should forward to port 8080. When ELB forwards this request to webserver A it is complete but when ELB forwards this request to webserver B it gives timeout.

    Similarly when the resquest is on port 444 it forwards to port 8081. When ELB forwards it to Webserver B it is complete and when forwarded to Webserver A it timesout.

    I would suggest either to go with a separate ELB or deploy your both applications on both the instances.