Tập tành AutoScalingGroup + Application Load Balencer Lab

Tập tành AutoScalingGroup + Application Load Balencer Lab

Share Everywhere

Table of contents

This lab ask you to create Auto Scaling Group + Application Load Balencer + Target Group on your own.

Prepare

Create your own VPC for simulate the Lab. You can create a new VPC with new feature by one click or do it the old way.

Start the Lab

There are three requirements:

  • Create 2 Security group
    • First Security Group for ALB which only allow inbound on port 80
    • Second Security Group for ASG which only allow traffic from ALB on port 80
  • Create ALB
    • Internet facing
    • Security Group only allow inbound on port 80
    • Target Group with:

      • Health check path: index.html
  • Create ASG with
    • launch configuration:
      • Instance type: t3.nano
      • Security Group : Only allow traffic from ALB
      • User Data
        yum update -y
        amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
        yum install -y httpd mariadb-server
        systemctl start httpd
        systemctl enable httpd
        usermod -a -G apache ec2-user
        chown -R ec2-user:apache /var/www
        chmod 2775 /var/www
        find /var/www -type d -exec chmod 2775 {} \;
        find /var/www -type f -exec chmod 0664 {} \;
        echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
        
    • Group Size:
      • Minimum and Desired Capacity: 2
      • Maximum Capacity : 4
    • Create Target Tracking Policy with:
      • Average CPU ultilization : 75

First requirement:

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Security Groups.

  3. Choose Create security group.

  4. Create first security group on allow traffic from internet(Source: Anywhere) on port 80

Tập tành AutoScalingGroup + Application Load Balencer Lab
  1. Create second security group on allow traffic from alb(Source: alb's security group) on port 80
Tập tành AutoScalingGroup + Application Load Balencer Lab

Second requirement:

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the left navigation pane, under Load Balancing, choose Target Groups.

  3. Choose Create target group.

  4. In the Basic configuration section, select Instance to specify targets by instance ID and enter a name for the target group.

Tập tành AutoScalingGroup + Application Load Balencer Lab
  1. Choose your VPC for simulate the Lab

  2. In the Health checks section, set the Health check to the target group with HTTP protocol and set the path to /index.php

Waf Configuration Lab
  1. In the navigation pane, under Load Balancing, choose Load Balancers. Choose Application Load Balancer

  2. For Load balancer name, enter a name for your load balancer.For Scheme, choose Internet-facing

Tập tành AutoScalingGroup + Application Load Balencer Lab
  1. For VPC, select the VPC that you used for your EC2 instances. If you selected Internet-facing for Scheme, only VPCs with an internet gateway are available for selection. For Mappings, select two or more Availability Zones and corresponding subnets
AutoScalingGroup + Application Load Balencer Lab
  1. For Security groups, select an existing security group. For Listeners and routing, the default listener accepts HTTP traffic on port 80 and forward to existed Target group that you create before
AutoScalingGroup + Application Load Balencer Lab

Third requirement:

  1. To create a launch configuration. On the navigation pane, under AUTO SCALING, choose Launch Configurations.

  2. Choose Create launch configuration, and enter a name for your launch configuration.

  3. For Amazon machine image (AMI) , choose an AMI (The AMI will be specify in the lab, sine i dont remeber it's AMI number so i will pick random). And choose Instance type: t3.micro

AutoScalingGroup + Application Load Balencer Lab
  1. For Advanced details, specify User Data to configure an instance during launch
AutoScalingGroup + Application Load Balencer Lab
  1. For Security groups, select existed security group which only allow traffic from ALB
AutoScalingGroup + Application Load Balencer Lab
  1. On the navigation pane, under AUTO SCALING, choose Auto Scaling group.

  2. On the Choose launch template and select the template that you just create, for Auto Scaling group name, enter a name for your Auto Scaling group.

AutoScalingGroup + Application Load Balencer Lab
  1. On the Configure instance launch options page, under Network, for VPC, choose a VPC. The Auto Scaling group must be created in the same VPC as the security group you specified in your launch configuration. For Availability Zones and subnets, choose one or more subnets in the specified VPC
AutoScalingGroup + Application Load Balencer Lab
  1. To register your Amazon EC2 instances with a load balancer, choose an existing load balancer
AutoScalingGroup + Application Load Balencer Lab
  1. On the Configure group size and scaling policies page, configure the following options:
    • Desired capacity: 2
    • Minimum capacity: 2
    • Maximum capacity: 4
AutoScalingGroup + Application Load Balencer Lab
  1. For Scaling Policies, choose Target tracking scaling policy and set the Metric type to Average CPU Utilization and set the target value to 75
AutoScalingGroup + Application Load Balencer Lab

You can check if everything it's ok by go to EC2 Dashboard

AutoScalingGroup + Application Load Balencer Lab

At this step you finish the lab

Bạn thấy bài viết này như thế nào?
2 reactions

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Bài viết liên quan

Khám phá FinOps

Khám phá FinOps - công nghệ đám mây

Nhiều doanh nghiệp ngày nay lựa chọn chuyển sang công nghệ đám mây với hi vọng đạt được lợi thế cạnh tranh so với đối thủ nhờ tiềm năng về hiệu quả cao và tiết kiệm chi phí hơn của công nghệ này.
Microservices Roadmap

Microservices Roadmap

- Kafka, RabbitMQ, Amazon SQS: Efficient and reliable message brokers for seamless communication between microservices.
The Data Analyst Roadmap

The Data Analyst Roadmap

**Database Knowledge**: Gain proficiency in working with databases like MySQL, PostgreSQL, or MongoDB.
Architectural patterns in software design

Architectural patterns in software design

Choose the architecture that aligns with your application's unique needs and goals. Each pattern offers a tailored approach to elevate your software system!
Exploring the Technological Marvel Behind Netflix

Exploring the Technological Marvel Behind Netflix

Ever wondered about the tech wizardry that powers your binge-watching adventures on Netflix?