0
0
AWScloud~30 mins

Why load balancing matters in AWS - See It in Action

Choose your learning style9 modes available
Why Load Balancing Matters
📖 Scenario: You are setting up a simple web service on AWS. You want to make sure your website stays online and fast even if many people visit at the same time. To do this, you will create a load balancer that shares the visitors' requests across multiple servers.
🎯 Goal: Build an AWS Elastic Load Balancer configuration that distributes traffic evenly to two web servers, ensuring better availability and performance.
📋 What You'll Learn
Create two EC2 instances with a simple web server
Create an Elastic Load Balancer (ELB) that listens on port 80
Register the two EC2 instances with the ELB
Configure health checks for the ELB to monitor instance health
💡 Why This Matters
🌍 Real World
Load balancing helps websites and apps stay fast and available when many users visit at once by sharing the work across multiple servers.
💼 Career
Understanding load balancing is essential for cloud engineers and architects to design scalable and reliable cloud applications.
Progress0 / 4 steps
1
Create two EC2 instances
Create two EC2 instances named web-server-1 and web-server-2 using the Amazon Linux 2 AMI. Both instances should be in the us-east-1a availability zone.
AWS
Need a hint?

Use resource "aws_instance" to create EC2 instances and set the tags block with the Name key.

2
Create an Elastic Load Balancer
Create an AWS Elastic Load Balancer named web-elb that listens on port 80 for HTTP traffic.
AWS
Need a hint?

Use resource "aws_elb" and define a listener block with ports set to 80.

3
Register EC2 instances with the Load Balancer
Register the two EC2 instances web-server-1 and web-server-2 with the Elastic Load Balancer web-elb using the instances attribute.
AWS
Need a hint?

Add the instances attribute inside the ELB resource and list the instance IDs.

4
Configure health checks for the Load Balancer
Add a health_check block to the Elastic Load Balancer web-elb that checks the path / on port 80 every 30 seconds with a timeout of 5 seconds and considers an instance healthy after 2 successful checks.
AWS
Need a hint?

Add a health_check block inside the ELB resource with the specified settings.