Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does an AWS application load balancer require two subnets? [closed]

When trying to create an application load balancer on aws (up until now I was using the classic ones just fine), I get the following message:

At least two subnets must be specified

Why would an ALB require me to specify two subnets ? Is there any way to create it and use it to LB between instances in a single subnet ?

like image 219
George Avatar asked May 08 '18 21:05

George


People also ask

Can Amazon ELB can only be used with public subnets?

To expand this just a bit: Your ELB should only be on public subnets, and only on subnets in the same availability zone(s) as your instance(s).

Do load balancers need to be in a subnet?

The load balancer must have at least one subnet at all times. You can add at most one subnet per Availability Zone.

How many subnets does alb have?

ALB requires at least two subnets across Availability Zones, NLB requires one subnet. The subnets must be tagged appropriately for the auto discovery to work. The controller chooses one subnet from each Availability Zone.

Can availability Zone have two subnets?

You can create a VPC that spans multiple Availability Zones. After creating a VPC, you can add one or more subnets in each Availability Zone. Each subnet must reside exclusively within one Availability Zone and cannot span zones.


3 Answers

So, just to be clear here. @pasmwel basically answered with the docs links but I want to clairfy it since this seems to be getting views.

ALBs require 2 subnets since so that if 1 availability zone goes down the ALB can still operate on the others.

Which is kinda silly... since AWS could be doing it in the background.

The normal ELB and the TCP LB don't require this for no apparent reason. But if a subnet falls down they will also fail.

like image 188
George Avatar answered Oct 17 '22 09:10

George


You might want an ALB as just somewhere to easily place a certificate, provide some security and easily integrate with R53 for a single target instance. Especially handy if you want to use Cloudformation to setup when it's maximum use of AWS.

So it does seem daft to have to configure 2 subnets. I have a vague recollection of reading somewhere that doing that and only using 1 results in lower performance but I could be dreaming that.

like image 32
Ian Avatar answered Oct 17 '22 07:10

Ian


so that if 1 region goes down

The above is wrong and should state

so that if 1 availability zone (AZ), in the region, goes down

The answer to the question is, there is not a good reason for AWS to require two subnets. There are use cases where one only wants one subnet for production and other cases where developers only want one subnet. One might think, why bother with an ALB if there is only one subnet. The answer is ALB can monitor instance health (even though there are other ways to monitor, for example, CloudWatch.

like image 1
Todd Booth Avatar answered Oct 17 '22 09:10

Todd Booth