Load Balancing in AWS
Layer 4 loadbalancing
- AWS has a network load balancer which is layer 4 loadbalancer.
- It understands
- ip
- protocol: tcp/udp
- ports
- AWS loadbalancers can be internal(private)/external(public)

- w.r.t compute aws supports auto scaling groups (try later)
- loadbalancer should forward requests only to healty ec2 instances for this they have health checks for ec2 instances
Lab setup
- Lets create an AMI with a custom website
- Use that AMI to create two ec2 instances
- We will configure loadbalancing
Steps for setting up vm
- Create an ubuntu EC2 instance
sudo apt update
sudo apt install nginx unzip -y
cd /tmp
wget https://templatemo.com/tm-zip-files-2020/templatemo_604_christmas_piano.zip
unzip templatemo_604_christmas_piano.zip
cd templatemo_604_christmas_piano
sudo cp -R . /var/www/html/
- Now access http://

- Now create ami
- After ami is create delete ec2 instance.
Network Creation and Loadbalancing
- Create a vpc with 2 public subnets
- create a security group which opens 80 port
- create two ec2 instances in two different subnets without public ip
- create a Network Load Balancer (Watch classroom recording)
AWS Load balancer concepts
- Target group: This refers to an application ec2 instances which can be scatter across subnets in a vpc
-
LoadBalancer will have
- target group: group of machines which are target to lb
- listener: rules
- Exercise: Try repeating the same
