title: Accessing AWS EC2 instances through ELB
body: <p>I'm trying to set up two instances under an elastic load balancer, but cannot figure out how I'm supposed to access the instances through the load balancer.</p>
  
  <p>I've set up the instances with a security group to allow access from anywhere to certain ports. I can access the instances directly using their "Public DNS" (publicdns) host name and the port PORT:</p>
  
  <p>http://[publicdns]:PORT/</p>
  
  <p>The load balancer contains the two instances and they are both "In Service" and it's forwarding the port (PORT) onto the same port on the instances.</p>
  
  <p>However, if I request</p>
  
  <p>http://[dnsname]:PORT (where dnsname is the A Record listed for the ELB)</p>
  
  <p>it doesn't connect to the instance (connection times out).</p>
  
  <p>Is this not the correct way to use the load balancer, or do I need to do anything to allow access to the load balancer? The only mention of security groups in relation to the load balancer is to <em>restrict</em> access to the instances to the load balancer only, but I don't want that. I want to be able to access them individually as well.</p>
  
  <p>I'm sure there's something simple and silly that I've forgotten, not realised or done wrong :P</p>
  
  <p>Cheers,
    Svend.</p>
  
  <hr>
  
  <p>Extra info added:</p>
  
  <p>The Port Configuration for the Load Balancer looks like this (actually 3 ports):</p>
  
  <p>10060 (HTTP) forwarding to 10060 (HTTP)
  Stickiness: Disabled(edit)</p>
  
  <p>10061 (HTTP) forwarding to 10061 (HTTP)
  Stickiness: Disabled(edit)</p>
  
  <p>10062 (HTTP) forwarding to 10062 (HTTP)
  Stickiness: Disabled(edit)</p>
  
  <p>And it's using the standard/default elb security group (amazon-elb-sg).</p>
  
  <p>The instances have two security groups. One external looking like this:</p>
  
  <p>22 (SSH)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0<br>
  10060 - 10061       0.0.0.0/0<br>
  10062 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0.0.0/0<br></p>
  
  <p>and one internal, allowing anything within the internal group to communicate on all ports:</p>
  
  <p>0 - 65535   sg-xxxxxxxx (security group ID)</p>
  
  <p>Not sure it makes any difference, but the instances are m1.small types of image ami-31814f58.</p>
  
  <hr>
  
  <p>Something that might have relevance:</p>
  
  <p>My health check used to be HTTP:PORT/ but the load balancer kept saying that the instances were "Out of Service", even though I seem to get a 200 response on the request on that port.</p>
  
  <p>I then changed it to TCP:PORT and it then changed to say they were "In Service".</p>
  
  <p>Is there something very specific that should be returned for the HTTP one, or is it simply a HTTP 200 response that's required? ... and does the fact that it wasn't working hint towards why the load balancing itself wasn't working either?</p>