Creating a Load Balancer (Classic ELB)

A load balancer basically distributes incoming application traffic across multiple EC2 instances in multiple availability zones. This increases the fault tolerance of your applications. Elastic load balancing detects unhealthy instances and routes traffic only to healthy instances. 

  1. To create a load balancer, go to the EC2 console, click on Load Balancers in the Load Balancing section at the left side. After that, click on Create Load Balancer:
  1. Once we click on Create Load Balancer, we will land on another page, where we will be asked to choose the load balancer type. Here, we pick Classic ELB, because we need network layer routing and not application layer routing: 
  1. After choosing Classic Load Balancer, we will enter the Load Balancer wizard, in which the first step is to define load balancer. Here, we have to enter or select the following information:
    • Load Balancer nameLB-ECSAPP
    • Create LB Inside: We have to select the same VPC in which the ECS Cluster Instances lies.
    • Listener Configuration:  LB Port 80 should listen to Instance Port 80.
    • Select both the available subnets. Basically two subnets in different availability zones provides higher availability for your load balancer.  After that, click on Next: Assign Security Groups:
  1. Once we click on Next: Security Group, we will move to step 2. Select the existing security group, which was created by ECS: 
  1. After that, click on Next: Configure Security settings. In this step, we can upload the SSL certificate, which will improve our load balancer security.

We haven't given port 443/https in the LB port, because we don't need it now. But, it's always a good practice to use either the HTTPS or the SSL protocol for your frontend connection. Click on Next: Configure health check. Here, we can fill the information as seen in the following image and click on Next: Add EC2 Instances:

  1. Once we click on Add EC2 Instances, we will get Step 5, where we have to select both the instances created by the ECS cluster. Then, click on Next: Add Tags:
  1. After that, we have to give some tags names and values. Post that, click on Review; after reviewing, click on create. Then, we will have a load balancer with two instances registered with it, but both instances will be in and out of services, because there is no  application running and serving on port 80 in container instances, which basically fails the condition of health checks:
  1. Once we are done with creating the load balancer, let's register the Auto Scaling group created by ECS cluster.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.201.209