Forwarding traffic from AWS ELB to another ELB

amazon-elbamazon-vpcamazon-web-servicesvpc-peering

I have 2 VPCs (X and Y). We have a vpc peering connection between the two. In VPC X, we have a CNAME that needs to resolve to an ELB in VPC Y. Is there any way to make an ELB in VPC X forward traffic to an ELB in VPC Y?

I know this configuration is weird and it's not something I can really change, so I'm going to try whatever makes sense to move forward.

Best Answer

You can't add an ELB as a backend behind another ELB.

You might be able to add instances in one VPC directly to an ELB in another if the VPCs are peered, but this seems unlikely.

The obvious workaround is the same one you use to work around most things (or maybe that's just me) -- a proxy server (or more than one, for redundancy) -- running in EC2 in the local VPC configured as a back-end instance behind the local ELB, routing requests across the peering connection to the remote balancer. HAProxy 1.6 or later can handle the periodically-changing IP addresses of ELB (ELB IP addresses change with automatic node scaling and/or failure) and Nginx can handle too, with correct configurarion.

Related Topic