I am trying to create a network with the following features in AWS:

  1. A private subnet with one EC2 instance, called 'Traffic Source'
  2. All HTTP(S) traffic from the Traffic Source subnet destined for is routed to an AWS Elastic Load Balancer
  3. The AWS Elastic Load Balancer routes traffic to an Auto-scaling group
  4. The Auto-scaling Group has a standard NAT Machine Image as its Launch Profile
  5. All HTTP(S) originating from the Auto-scaling Group, destined for is routed to an Internet Gateway

I'm having trouble with configuring the route for Step 2, above: routing traffic from the Traffic Source to the Load Balancer. Route Tables in AWS, as far as I know, only take a single IP address in CIDR format or a resource ID.

AWS Elastic Load Balancers of course have several IP addresses, a canonical DNS name and no resource ID.

How can I route traffic from a private subnet in AWS VPC to an internal AWS Elastic Load Balancer using the Route Tables feature in AWS?

Due to internal constraints at my organization, the new NAT Gateway product at AWS is not an option I can use.


If you are unable to use NAT Gateway because it isn't supported by Cloud Formation yet, try a combination of custom Cloud Formation resource types and AWS lambda functions--which then use the JavaScript AWS API to create, read, update and delete NAT Gateway settings.

  1. Create Custom Resource Types in your Cloud Formation templates
  2. Your Custom Resource Types will call AWS Lambda Functions, which you write
  3. Use the AWS API in your AWS Lambda Functions to create, read, update and delete NAT Gateway resources

For more detailed examples on how to do this, see the page linked here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.