Elastic Load Balancer & Auto scaling groups

Lets learn about ELB and ASG

Difference between Scalability, High Availability, Elasticity and Agility.

Scalability :

An app / system can handle greater loads by adapting. There is 2 types of scalability :

  • Horizontal Scalability -> Increasing your number of resources (nodes, instances) - (Scale out/in) - aka elasticity. => Very common for web applications and modern applications

  • Vertical Scalability -> Making your current resources better (increasing the size) - Upgrading ( scale up / down) e.g. going from t2.micro to t2.large => Very common for non distributed systems such as database and the it has the (hardware limit)

Elasticity :

This means that the system will have auto-scaling So it will scale up when the demand is high and scale down when the demand is low, This is extremely cost-efficient and useful for on-demand or pay-per-use things as it can save a lot of money and you don't have to keep "guessing capacity"

Agility :

Means that you can do things very quickly because you can get/delete IT resources in a matter of seconds And is not related to scalability - Distractor

High Availability :

Running your application or system across multiple Availability Zones ( in a minimum of Availability Zones).

Elastic Load Balancer

  • Basically, the load balancer will distribute the traffic across multiple targets/servers and it can across multiple Availability Zones.

  • Provide SSL termination (HTTPS) for your websites, and expose one point of access (DNS) to your application.

  • It monitors the health of all your targets and only spreads the load to the healthy targets, so it basically does health check as well.

  • ELB is a managed Load Balancer by AWS, so AWS takes care of most of the stuff: you can also create your own but it's much more effort to maintain and integrate.

There are 3 main types of Load Balancer :

  1. Application Load balancer - Layer 7 -> HTTP and HTTPS.

  2. Network Load Balancer - Layer 4 .AKA. transport layer -> for high performance, TCP and UDP connections.

  3. Classic Load Balancer (L7+4) -> It can only be used with EC2 classic instances. it is slowly retiring.

Auto-Scaling Group - ASG :

  • Normally if you have an app or system, it won't continually be under maximum load.

  • So if you're underestimating or overestimating your load, ,then there could be problems with cost and also, availability for customers/users, e.g. they might not be able to access the website because there might be a lot of latency because of too many users on the platform.

  • This is when ASG comes in; ASG automatically : -> Scales out when there is an increased load. -> Scales in when there is decreased load. -> It will also replace unhealthy targets/instances.

  • ASG and ELB work very well together because ASG can provide the instances and ELB can distribute the load between all of them.

ELB & ASG - Summary

  • High Availability vs Scalability ( Vertical and Horizontal ) vs Elasticity vs Agility in the cloud.

  • Elastic Load Balancers - ELB -> Distribute traffic across backend EC2 instances, can be Multi-AZ -> Support health checks -> 3 types : App LB ( HTTP/S - L7 ), Network LB ( TCP - L4), Classic LB (old)

  • Auto Scaling Groups ( ASG ) -> Implement Elasticity for your application, across multiple AZ -> Scale EC2 instances based on the demand on your system, replace unhealthy. -> Integrated with ELB

Last updated