Search code examples
amazon-web-servicesarchitectureaws-fargateaws-application-load-balancerhub

Hub-Spoke Architecture on AWS with Fargate with public and internal loadbalancer


Hi i have an issue where i have a hub spoke architecture as follows: enter image description here

The issue is i want to forward the traffic from the hub network load balancer to the internal application load balancer in the spoke so i can run fargate tasks in multiple availability zones.

is there a other way to solve this without a lambda function which forwards the traffic?

  1. I tried to create a target group which points to the internal ip of the internal ALB - no success
  2. i tried different LB types
  3. i can only add LB in the same VPC to a target group
  4. i checked the routing - no issues here

Solution

  • As you noticed, you can only target NLB to an ALB in the same VPC.

    ALB doesn't have a static address, so you cannot target it directly by IP either.

    You can do the following:

    1. Set up a peering connection and routing between your VPCs
    2. Add another NLB in front of the ALB in the target VPC.
    3. Target your source NLB to the target NLB by IP.

    NLB has static IPs that don't change:

    When you create an internal load balancer, you can optionally specify one private IP address per subnet. If you do not specify an IP address from the subnet, Elastic Load Balancing chooses one for you. These private IP addresses provide your load balancer with static IP addresses that will not change during the life of the load balancer. You can't change these private IP addresses after you create the load balancer.