DEV Community

Cover image for AWS Learn In Public Week 2, Load Balancers and Auto Scaling
Harris Geo 👨🏻‍💻
Harris Geo 👨🏻‍💻

Posted on • Updated on • Originally published at harrisgeo.me

AWS Learn In Public Week 2, Load Balancers and Auto Scaling

Week 2 of my AWS challenge and things are going great! Learning how ELBs (Elastic Load Balancer) and ASGs (Auto Scaling Group) work connects many dots on the wider topic of understanding the cloud infrastructure.

The deeper I dive into all these concepts, the more interesting things get and it makes a lot more sense on many aspects of full stack development. Here's a breakdown of what happened this week.

28/02

What is an AWS ELB (Elastic Load Balancer)?

A server that evenly distributes internet traffic to multiple EC2 instances.

Load balancing is a good way to ensure high availability to your system in case one of the instances goes down.

01/03

AWS provides 3 kinds of load balancers

✅ CLB (Classic Load Balancer)

✅ ALB (Application Load Balancer)

✅ NLB (Network Load Balancer)

CLB is old generation and supports HTTP, HTTPS and TCP

ALB is the most common amongst modern applications and supports HTTP, HTTPS and Websockets

NLB is mainly used for high performance job and supports TCP, TLS and UDP

02/03

What is Load Balancer Stickiness?

A cookie to instruct our load balancer to redirect each independent user to the same instance.

➕ works for CLB and ALB

➕ can control the expiration date

➖ can bring imbalance to the load balancer

03/03

What is SSL (Secure Socket Layer) and TLS (Transport Layer Security) in AWS?

Both of them are certificates which allow traffic between your clients and your load balancer to be encrypted in transit (also referred to as in flight encryption)

Good to knows.

TLS is a new version of SSL.

People quite often use TLS but refer to them as SSL.

04/03

What is Connection Draining in AWS Load Balancers?

The time to complete "in-flight requests" while the instance is de-registering or unhealthy.

Once the instance is de-registering, it stops receiving requests.

This process can take 1-3600 seconds.

05/03

What is an AWS ASG (Auto Scaling Group)

A setting for managing changes to traffic with a goal to:

📈 scale out (add EC2 instances) to match increased load

📉 scale in (remove EC2 instances) to match decreased load

What does ASG look in AWS? We have

✅ Minimum size which is the lowest amount of instances required for our system to be functional.

✅ Actual size / desired capacity: the setup normally we have

✅Maximum size - the amount of instances we can allocate to handle the extra load

06/03

Let's talk about AWS ASG policies. We have 3 kinds 💈

  1. Target tracking scaling

It is quite simple and the easiest one to setup.

It is when you set rules of e.g. the CPU usage to stay at around 40%

  1. Simple or step scaling

➕ When a CloudWatch alarm is triggered (e.g. CPU > 70%) then add 2 units

➖ When a CloudWatch alarm is triggered (e.g. CPU < 30%) then remove 1 unit

  1. Scheduled Actions

This is based on know usage patterns like on a busy weekend or on BlackFriday

Finally let's talk about AWS ASG scaling cooldowns

A cooldown is a period to ensure your ASG doesn't add or remove instances before the previous scaling activity takes place.

The default cooldown period is 300 seconds. Can be reduced to 180.

Example: A policy that terminates instances based on criteria or metric, EC2 Auto Scaling needs less time to determine wether to terminate additional instances

If your application is scaling up or down multiple times each hour, then that's a good indicator that you need to modify your ASG cooldown timers.

Week 2 Summary

Learning AWS is quite interesting because it feels like even the small bits help a lot. I find it quite easy to wake up in the morning because early AM before work now means AWS time.

Understanding load balancing answers many questions on how big sites handle their traffic. Some things I have noticed is that getting this concept of how things work in the cloud changes a lot the way I started thinking about development. More of that in the next blog posts to come.

If you want to follow my journey, feel free to follow me on Twitter and please reach out :). Next week I will be looking at AWS EBS (Elastic Block Store), EFS (Elastic File System) and RDS (Relational Database System).

Top comments (2)

Collapse
 
fullstackcoder profile image
fullstackcoder • Edited

Bare in mind that there is also a newly introduced ELB called Gateway Load Balancer. Ωραίο post 👍

Collapse
 
harrisgeo88 profile image
Harris Geo 👨🏻‍💻

Yeah I noticed that but they don't have it available in the London region yet so didn't pay attention to it. Euxaristw!