- Names are arbitrary values. Specified for our use case because CA performs component checks using name as identifiers.
- Component creation is sequenced in a logical order based on dependency.
- Launch Template (LTs) are templates and Launch Configuration (LCs) & Auto-Scaling Group (ASGs) are implementation of the said template.
- Type: Instances.
- Name: website-tg.
- Protocol: TCP (Load balancer can only attach with TCP or UDP. HTTP and HTTPS are sub-protocol implementation of TCP).
- Type: Network Load Balancer.
- Name: website-lb.
- Zones: Select all.
- Target Group: website-tg.
- After LB is created, goto LB dashboard and in the actions menu edit it's attributes to enable Cross-Zone Load Balancing.
- Name: webserver-cluster-sg
- Description: Webserver cluster security group.
- Inbound Rules: Add SSH and HTTP rules with source originating from anywhere.
- Outbound Rule: Change destination type of pre-existing rule to anywhere (just to be sure that our instances are able to access the internet).
- Name: webserver-cluster-lt
- Description: Webserver cluster launch template
- Checkbox: Provide guidance for use with EC2 Auto Scaling (Some of the LT fields are required by ASG which are otherwise considered optional. This option marks those fields as required).
- AMI: Amazon Linux 2 x86
- Instance Type: t3.micro
- Network Settings: VPC.
- Security Groups: webserver-cluster-sg.
- User data/script:
#!/bin/bash
sudo yum update -y
sudo yum install -y httpd git
sudo git clone https://github.com/hardeepnarang10/ec2-mp-website.git /var/www/html/
sudo service httpd start
- Name: webserver-cluster-asg
- Launch template: webserver-cluster-lt
- VPC: Available preconfigured option (Configuration here is he same as the one we did in the other VPC lab.
- Subnets: Select all.
- Load balancing: Attach to an existing load balancer.
- Choose load balancer: webserver-lb.
- Max Capacity: 4. Desired Capacity: 2.
- Scaling policies: Target tracking scaling policy.
- Metric type: Average CPU utilization (Scales based on what percentage of the CPU is being used).
- Target value: 50 percent (Threshold value for scaling IN/OUT - configured with a relaxation time limit, the default value of 300 secs should be sufficient in our use case).