9

I currently have multiple instances of the same web application running on different instances by different vendors (AWS, Digital Ocean, Vultr). Each application instance run on their own port numbers.

I wish to configure AWS Applilcation/Network Load Balancer such that it will forward the requests to these endpoints:

Client -- HTTP Request --> Domain Name --> AWS Load Balancing Endpoint (IP Address?) --> Load Balancer rules --> Instances on AWS / Digital Ocean / Vultr.

Is there a way to do the above?

Ah Lim
  • 91
  • 1
  • 1
  • 3

2 Answers2

5

AWS Application Load Balancer’s Target Group can have either EC2 instance or IP address targets. In your case you need to use the IP address targets.

Here are the instructions: Application Load Balancing to IP Address

These addresses can be in the same VPC as the ALB, a peer VPC in the same region, on an EC2 instance connected to a VPC by way of ClassicLink, or on on-premises resources at the other end of a VPN connection or AWS Direct Connect connection.

Paul
  • 3,037
  • 6
  • 27
  • 40
MLu
  • 24,849
  • 5
  • 59
  • 86
  • 8
    "Minor" detail: you also need VPNs for this to work. *"Application Load Balancers can now route traffic directly to IP addresses. These addresses can be in the same VPC as the ALB, a peer VPC in the same region, on an EC2 instance connected to a VPC by way of ClassicLink, or on on-premises resources at the other end of a VPN connection or AWS Direct Connect connection."* ALBs can't route to arbitrary destinations on the Internet. – Michael - sqlbot Dec 18 '18 at 14:03
  • 1
    Note also that, for targets located outside the load balancer’s VPC, "You can use... any IPv4 address from the RFC 1918 ranges (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) or the RFC 6598 range (100.64.0.0/10)" – claytond Aug 18 '20 at 03:15
  • How add ip to aws LB, in case the IPs are dynamic ? – Ciasto piekarz Dec 26 '20 at 21:28
2

Alternative is to use a Lambda target on the Application Load Balancer, and have the Lambda proxy the requests through to your external IP.

Or an EC2 / ECS hosted proxy.

kos
  • 146
  • 7