Ref: https://learn.cantrill.io/courses/1820301/lectures/41301439 and https://learn.cantrill.io/courses/1820301/lectures/41301440
Traditional Load Balancer (LB)
- đź”§Â Server that accepts connections from clients, then distributes those connections in a balanced way across any registered backend resources
- âť—Â Clients are abstracted away from physical infrastructure!
- Backend resources can fail or scale seamlessly, without disrupting the client's experience
AWS Elastic Load Balancer (ELB) - Architecture
Diagram: https://github.com/acantril/aws-sa-associate-saac03/blob/main/1500-HA_and_SCALING/00_LEARNINGAIDS/ELB-1.png
- đź”§Â ELB = AWS-managed LB in your VPC
- Deploys nodes in at least 2 AZs → ELBs are HA across AZs, and can scale
- Backend resources are registered in the ELB's Target Group (TG)
- Can be EC2 instances, an EC2 ASG, Lambda functions…
- 💡 AWS likes to put the name “Elastic” in front of many of their products, emphasizing the elastic capability of the cloud
- ‼️ Officially part of Amazon EC2! → configured in EC2 console UI
- Historical reasons: before, only EC2 instances accepted as backend resources
- Nowadays EC2 instances, ECS clusters, Lambda functions, etc can be targets (backend resources) of an ELB
- Configuration:
- IPv4-only OR dual-stack (IPv4 + IPv6)
- DNS record(s) (A or AAAA record(s)) which resolve(s) to ELB nodes
- Any connections to the DNS name are distributed equally through ELB nodes
- AZs to use (specifically, one subnet per AZ, in at least 2 AZs)
- 1+ Nodes placed in each chosen AZ subnet
- Nodes can be replaced if failure → HA
- Nodes can scale → more nodes created if more load coming into the ELB
- Internet-facing ELB OR internal ELB
- internet-facing ELB → nodes have both private and public IPs
- internal ELB → nodes only have private IPs → generally used internally to separate different app tiers
- Listener: controls WHAT the LB does (what it listens to and how it reacts)
- Accepts traffic on a port & protocol
- Communicates with targets (backend resources) on a port & protocol
- Once connection with client established, ELB connects with compute resources (EC2 instances, ECS clusters…)
- ‼️ Backend resources can be public or private! REGARDLESS of whether the ELB is internet-facing or internal!!
- Backend instance IPs are different from ELB IPs, subnets can also differ
- âť—Â ELBs need 8+ free IPs per subnet AND a /27 or larger subnet to allow scaling
- ‼️ Strictly speaking, a /28 subnet works!
- 💡 That's 16 IPs (minus the 5 that are AWS reserved, that leaves 11 free IPs…)
- …HOWEVER! AWS suggests a /27 or larger subnet so that it can scale!
- 💡 Default to thinking of /27 as the minimum size, but if in the exam they give /28 as an option and not /27, then /28 is the right answer!
AWS ELB - Abstraction of Infrastructure
Diagram: https://github.com/acantril/aws-sa-associate-saac03/blob/main/1500-HA_and_SCALING/00_LEARNINGAIDS/ELB-2.png
- Without ELBs, clients connect to servers/instances directly → tight coupling between tiers
- 👎 If instances fail or scale, the client experience is be disrupted
- With ELBs, there is abstraction between tiers → loose coupling between tiers
- 👍 Instances can fail or scale, clients don't notice
AWS ELB - Cross-Zone Balancing