title: How do I connect a public-facing load balancer to EC2 instances in a private VPC
body: <h1>Background</h1>
  
  <p>I want to deploy a laravel application to Elastic Beanstalk. The setup includes a VPC with two private and two public subnets. The EC2, RDS etc. are all in the private subnets. </p>
  
  <p>Only the ELB is in the public ones. And should route everything into the private ones.</p>
  
  <h2>Issue</h2>
  
  <p>If I try to connect over the ELB I receive a TIMEOUT error.</p>
  
  <p>I am not sure if this is a configuration problem (VPC/Subnets) or an application (EB) error.</p>
  
  <p>The requests however seem to go through and get routed correctly, I guess. Because if I check the Elastic Beanstalk logs for example the <code>httpd/access.log</code> </p>
  
  <p>I see the requests made through the ELB.</p>
  
  <p><code>
  13:38:20
  10.0.2.52 (94.79.175.190) - - [22/Oct/2018:13:38:19 +0000] "GET /loadbalancertest HTTP/1.1" 307 307 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.
  </code></p>
  
  <p>The healthcheck however seem to work fine. And the application state is OK.</p>
  
  <h2>Infrastructure</h2>
  
  <ul>
  <li>1 VPC</li>
  <li>2 Private Subnets</li>
  <li>2 Public Subnets </li>
  </ul>
  
  <hr>
  
  <h3>ELB</h3>
  
  <p>The ELB is in the two public subnets. </p>
  
  <p><strong>ELB Security Group Settings</strong></p>
  
  <p>Inbound: HTTP / TCP / 80 / 0.0.0.0/0</p>
  
  <p>Outbound: HTTP / TCP / 80 / 0.0.0.0/0</p>
  
  <hr>
  
  <h3>EC2 Instance (created by EB)</h3>
  
  <p><strong>VPC Security Group Settings</strong></p>
  
  <p>Inbound: HTTP / TCP / 80 / sg-03xxxxx (ELB SG)</p>
  
  <p>Outbound: All traffic / 0.0.0.0/0</p>