Day 41: Setting up an Application Load Balancer with AWS EC2

Day 41: Setting up an Application Load Balancer with AWS EC2

What is Load Balancing?

Load balancing is the distribution of workloads across multiple servers to ensure consistent and optimal resource utilization. It is an essential aspect of any large-scale and scalable computing system, as it helps you to improve the reliability and performance of your applications.

Elastic Load Balancing:

Elastic Load Balancing (ELB)?is a service provided by Amazon Web Services (AWS) that automatically distributes incoming traffic across multiple EC2 instances. ELB provides three types of load balancers:

  1. Application Load Balancer (ALB)?-?operates at layer 7 of the OSI model and is ideal for applications that require advanced routing and microservices.
  2. Network Load Balancer (NLB)?-?operates at layer 4 of the OSI model and is ideal for applications that require high throughput and low latency.
  3. Classic Load Balancer (CLB)?-?operates at layer 4 of the OSI model and is ideal for applications that require basic load balancing features.

Today's Tasks:

Task 1:

launch 2 EC2 instances with an Ubuntu AMI and use User Data to install the Apache Web Server.

Log in to your AWS Console and go to the EC2 dashboard.

Click on the "Launch Instance" button and select "Ubuntu Server ".

No alt text provided for this image

Choose the instance type, configure the instance details, add storage, and configure security groups as required.

No alt text provided for this image
No alt text provided for this image

In the "Configure Instance Details" page, scroll down to the "Advanced Details" section and expand the "User data" field.

In the "User data" field, enter the following commands to install and start the Apache web server:

No alt text provided for this image

You can see two instances are created.

No alt text provided for this image


Modify the index.html file to include your name so that when your Apache server is hosted, it will display your name also do it for 2nd instance which include " TrainWithShubham Community is Super Awesome :) ".

For apache-server1

Check apache2 status using below command:

No alt text provided for this image

Go inside /var/www/html path and edit index.html file

No alt text provided for this image
No alt text provided for this image

Copy the public IP address of your EC2 instances.

Open a web browser and paste the public IP address into the address bar.

You should see a webpage displaying information about your PHP installation.

No alt text provided for this image

For apache-server2:

Check apache2 status.

Go inside /var/www/html path and edit index.html file

No alt text provided for this image
No alt text provided for this image

Copy the public IP address of your EC2 instances.

Open a web browser and paste the public IP address into the address bar.

You should see a webpage displaying information about your PHP installation.

No alt text provided for this image

Task 2:

Create an Application Load Balancer (ALB) in EC2 using the AWS Management Console.

Log in to the AWS Management Console and go to the EC2 dashboard.

Click on "Load Balancers" in the left-hand navigation menu and then click the "Create Load Balancer" button.


No alt text provided for this image

Select "Application Load Balancer" as the load balancer type and click "Create".

No alt text provided for this image

Configure the load balancer settings, such as name, listener, security group, and availability zones. For the listener, you can choose HTTP or HTTPS, depending on your application's requirements.

No alt text provided for this image
No alt text provided for this image

Configure "Security Groups"

No alt text provided for this image

Create a target group by specifying a name, protocol, port, and health check settings. Choose the same availability zones as the load balancer and select the instances that you launched in Task 1 as targets for the target group.

No alt text provided for this image

Add EC2 instances which you launch in task-1 to the ALB as target groups.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Load balancer is created.

No alt text provided for this image

Target group is created.

No alt text provided for this image

Verify that the ALB is working properly by checking the health status of the target instances and testing the load balancing capabilities.

Verify that the instances are registered with the load balancer by checking the target group's health status. You should see a healthy status for all instances in the group.

No alt text provided for this image

Test the load balancing capabilities by accessing the load balancer's DNS name in a web browser . You should see traffic being evenly distributed across the instances.

No alt text provided for this image


No alt text provided for this image

Thank you for reading!

Prakash Bohara

Immediate Joiner | #Engineer Devops ?? | MySQL | LINUX ??| Git/GitHub?? | AWS ? | DOCKER ??| KUBERNETES ?? | TERRAFORM ??? | JENKINS | ANSIBLE??| EKS/GKE

1 年

your blog help on second task .. Thanks ??

回复

要查看或添加评论,请登录

Sayali Shewale的更多文章

  • DevOps Project-3

    DevOps Project-3

    Project Description The project involves hosting a static website using an AWS S3 bucket. Amazon S3 is an object…

    7 条评论
  • DevOps Project-2

    DevOps Project-2

    Project Description The project is about automating the deployment process of a web application using Jenkins and its…

    2 条评论
  • Day 80: DevOps Project-1

    Day 80: DevOps Project-1

    Project Description The project aims to automate the building, testing, and deployment process of a web application…

    4 条评论
  • Day 73 - Setup Grafana on AWS EC2 Instance

    Day 73 - Setup Grafana on AWS EC2 Instance

    Task: Setup grafana in your local environment on AWS EC2. Go to the AWS console and Launch an EC2 instance Open port…

    2 条评论
  • Day 72 - Grafana

    Day 72 - Grafana

    What is Grafana? Grafana is an open-source data visualization and monitoring tool that allows you to query, visualize…

    3 条评论
  • Day 70 - Terraform Modules

    Day 70 - Terraform Modules

    Modules are containers for multiple resources that are used together. A module consists of a collection of .

    2 条评论
  • Day 69 - Meta-Arguments in Terraform

    Day 69 - Meta-Arguments in Terraform

    When you define a resource block in Terraform, by default, this specifies one resource that will be created. To manage…

    1 条评论
  • Day 68 - Scaling with Terraform

    Day 68 - Scaling with Terraform

    Understanding Scaling Scaling is the process of adding or removing resources to match the changing demands of your…

  • Day 67: AWS S3 Bucket Creation and Management using terraform

    Day 67: AWS S3 Bucket Creation and Management using terraform

    AWS S3 Bucket Amazon S3 (Simple Storage Service) is an object storage service that offers industry-leading scalability,…

    1 条评论
  • Day 66 - Terraform Hands-on Project - Build Your Own AWS Infrastructure with Ease using Infrastructure as Code (IaC)

    Day 66 - Terraform Hands-on Project - Build Your Own AWS Infrastructure with Ease using Infrastructure as Code (IaC)

    Task: 1.Create a VPC (Virtual Private Cloud) with CIDR block 10.

    3 条评论

社区洞察

其他会员也浏览了