AWS Learn In Public Week 2, Load Balancers and Auto Scaling
Tags: aws, learninpublic, 100daysofaws
Published: 2021-03-07 16:41:35

---
title: AWS Learn In Public Week 2, Load Balancers and Auto Scaling
published: true
description: Lets talk about ELBs ASGs and more
tags: 
- aws
- learnInPublic
- 100DaysOfAWS
cover_image: https://user-images.githubusercontent.com/630705/110246739-b4182000-7f60-11eb-8663-c8a70db1bf51.jpg
canonical_url: https://www.harrisgeo.me/blogs/aws-learn-in-public-week-2-load-balancers-and-auto-scaling
series: AWS Learn in public
---

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](https://twitter.com/harrisgeo88/status/1366012293272670213)

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](https://twitter.com/harrisgeo88/status/1366373185386553346)

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](https://twitter.com/harrisgeo88/status/1366737569006817286)

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](https://twitter.com/harrisgeo88/status/1367097946307633152)

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](https://twitter.com/harrisgeo88/status/1367460083089641474)

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](https://twitter.com/harrisgeo88/status/1367844869331247106)

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](https://twitter.com/harrisgeo88/status/1368184857793163266)

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%

2.  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

3. 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](https://twitter.com/harrisgeo88) 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).