Create Target Group, Load Balancer

Create Target Group

  1. Search EC2 -> go down to Load Balancer and select create Target group

  2. Target group configuration settings are as follows:

  • Choose a target type: select Instances

  • Target group name: TG1 TG

  • VPC section: Select ASG-ALB-vpc TG

  • We keep the remaining parts unchanged and click next and create

Create Load Balancer

  1. Search EC2 -> go to Load Balancer

  2. In the Load balancer types section: Select Application Load Balancer and click Create LB

  3. Name it ALB1 LB

  4. Network mapping section:

  • Select VPC as ASG-ALB-vpc
  • Select 2 Availability Zones, then select 2 public subnets LB
  1. In the Security group section, delete the default security group and select ALB-1
  2. In the Listeners and routing section, select Default action as TG-1 LB

Note: The load balancer periodically sends pings, connection attempts, or requests to test the EC2 instance. These tests are called health checks.

  1. Leave the rest as default and click Create Load Balancer

Note: We must specify the availability zones for which the load balancer needs to be enabled, causing it to only route traffic to the two targets launched in those availability zones. You must include subnets from at least two Availability zones to make our load balancer Highly-Available.