Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get an AWS Application load balance to forward to a target group in a different vpc?

I've setup an Application Load Balancer in my primary VPC where most of my instances are. I have some instances in another VPC hosting docker services and I want to setup rules to access these at http://domain.com/services/. I have peering enabled between the two VPCs and I've created a target group, but the ALB only lists target groups within its own VPC. Is there any way to access the target group in the peered VPC or am I out of luck? I've been unable to find any leads on google so far. I've made sure the subnets in the ALB have routing through the VPC peering, but that hasn't helped.

like image 513
Ilion Avatar asked Feb 05 '23 00:02

Ilion


2 Answers

You can load balance using ALBs and use the internal IP address of the peered VPC. You can do this via selecting the target type as ip when setting up the Target Group.

Amazon has a great write up on this exact problem and solution: https://aws.amazon.com/blogs/aws/new-application-load-balancing-via-ip-address-to-aws-on-premises-resources/

Since you are going VPC to VPC, substitute their "on premise" wording with "my other VPC". I just set this up using a host header routing for the ALB to cross two VPCs with a single ALB.

like image 183
Adam Link Avatar answered Feb 11 '23 21:02

Adam Link


try with Route 53 routing policy. you can balance instance beyond the region also.

like image 37
Manivannan Thirugnanam Avatar answered Feb 11 '23 19:02

Manivannan Thirugnanam