1
votes

I have a basic question with respect to how a load balancer works. I have a VPC created with 3 subnets one in each availability zone(us-west-2a,us-west-2b,us-west-2c) and a 4th subnet in the same availability zone us-west-2a.

Now when I enable Availability Zones for the load balancer, I enable it in us-west-2a,us-west-2b,us-west-2c (subnet1, subnet2, subnet3).

I also have instances running in subnet 4 in us-west-2a. How to enable the load load balancer route traffic to instances in the 4th subnet? Any thoughts?

1
Just add the instance to your target group. Nothing special needs to be done.Marcin
adding the vpcId to the target group - makes it work?vkr
You register instances with target groups using instance-id. Not sure what do you mean by VPCId? Do you have custom vpc?Marcin
My TargetType is ip and yes it is a custom vpc and not a default vpc.vkr
Instances should use instance-id, not ip. But anyway, it doesn't work?Marcin

1 Answers

2
votes

Based on the comments and chat discussion.

The question arises from confusion between subsets selected when one creates NLB, and subsets used by instances.

Since the OP has enabled 3 subnets in 3 AZs (us-west-2a,us-west-2b,us-west-2c; one subnet per AZ) for the NLB, instances can be in any subset withing these zones and same VPC. The instances do not have to be in the same subnets as the NLB.

Therefore, since the 4th subnet is in us-west-2a, instances created in this subnet need to be only registers with a target group used by NLB.