Flexible Engine - Advanced guide


Updated on :

Step 5 – Configuring Auto Scaling (AS)

For this step, we will configure Auto Scaling (AS) service, so that our website can adapt the consumption of its resources according to the number of user requests received.

The AS uses predefined rules to automatically adjust the resources of the service, according to user service requirements. With this service enabled, you can customize the scaling configurations and policies to meet service requirements and reduce resource consumption. The AS you create will allow you to automatically increase or decrease the number of ECS.

To create an AS, choose Auto Scaling service, click on the button Create AS Group and fill in the following information:

  • AZ: eu-west-0a & eu-west-0b
  • AS Group Name: as-group-advanced
  • ECS Instance:
    • Instances: 3
    • Expected Instances: 1
    • Instances: 1
  • VPC: web-vpc
  • Subnet: web-subnet
  • Load Balancing: Use Classic Load Balancer
    • Load Balancer: elb-advanced
    • Listener: listener-advanced-ssh
  • Load Balancing: Use Classic Load Balancer
    • Load Balancer: elb-advanced
    • Listener: listener-advanced
  • Instance Removal Policy: Oldest instance created based on the oldest configurations
  • EIP: Release
  • Health Check Method: ELB health check
  • Health Check Interval: 5 minutes

 

Click Next and fill in the following information:

  • Tick Create AS Configuration
  • Configuration Name: as-config-advanced
  • Configuration Template: create a new template
    • Select the S3.Small.1
    • Private Image
    • Image : ecs-web-new
  • EIP: Do not use
  • Key Pair: KeyPair-web
  • Tick the box to acknowledge that you have downloaded the key pair
  • Advance settings : Configure Now
    • As text :
      #!/bin/bash
      Sudo sed –I –e “s/It works/$HOSTNAME \: It Works/” /var/www/html/index.html
  • Click Next to add AS Policy, and fill in the following information:
  • Policy Name: as-policy-cpu
  • Policy Type: Alarm
  • Alarm: Create
  • Alarm Name: as-alarm-sup10
  • Trigger Condition: CPU Usage / Average > 10%
  • Monitoring Interval: 5 minutes
  • Consecutive Occurrences: 1
  • Scaling Action: Add / 1
  • Cooling Duration (s): 300

 

Click the button Create Now before confirming the specifications.

 

At the end of configuration, you will have as-group-advanced (AS Group) successfully created.

 

 

Click as-group-advanced for more details about the newly created instances by AS.

 

 

By clicking on the Instance, you will have the list of instances created by Auto Scaling. The newly created virtual machines may also be visible in this list of virtual machines within the Elastic Cloud Server service.