AWS Elastic Load Balancing in a Private Subnet
By : Josh -
I recently learned a valuable lesson when setting up load balancing using an Elastic Load Balancer within a Virtual Private Cloud using public and private subnets and a NAT host.
When creating the ELB, be sure to create it within the public subnets and not the private subnets where the instances that will be attached to the subnet exist!
Creating the ELB within the public subnet(s) will allow them to route through the internet gateway and route traffic properly.
Note that any instance within the private subnet requires a route to the NAT host in the public subnet which has an EIP for internet access through the internet gateway. Any instance in the public network requires an EIP to allow routing through the internet gateway.