Lab 1 Predictive Autoscaling

Within the Elastigroup Dashboard Select the Groups button and then click into your Elastigroup that you created using Cloudformation Earlier. The name of the group should be ElastigroupQuickStart. We will now begin making a series of changes within our Elastigroup configuration to:

  • Change the AMI that Elastigroup is using to an Amazon Linux 2 AMI
  • Enable Cloudwatch Detailed Monitoring to increase monitoring granularity to 60 seconds
  • Change the startup/user data script to include a stress utility that will place CPU strain on the running instances (and then trigger scaling)
  • Modify the cooldown settings of our scaling configuration to 60 seconds

Follow along the recorded video to get started, the user-data script will also be included below for ease of changes:

#!/bin/bash
sudo su
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd.x86_64
systemctl start httpd.service
systemctl enable httpd.service
echo "Hello World from $(hostname -f)" > /var/www/html/index.html
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
stress --cpu 1 --timeout 720s

Now let’s review what to expect:

  • We made several changes to the underlying Elastigroup configuration that will require us to roll the instances in this group. We opted for a very forceful roll that will replace 100% of the instances in 60 seconds. This is not recommended in real-life applications, but we want to apply the changes very quickly for this lab.

  • The Elastigroup has predictive autoscaling enabled with a target scaling policy of 50%, the stress utility will continously force the instances in the group CPU above 50% triggering scaling events.

  • Review how Elastigrop is responding and adding instances over the next 10-15 minutes. Review the Overview Tab to see the scaling activity of the group, Instances Tab to see the actual instances being added to the group and the Log tab to explain the activity occuring behind the scenes. In real-world Elastigroups, predictive autoscaling enables Elastigroup to use machine learning algorithms to predict and determine the value of the predicted metric for up to two days in advance.

Overview

The overview tab will show the progression of adding instances to the group. You will also see the progressive scale down once the stress utility stops runinng ~10-15 minutes.

Instances

You will likely see an instance being added every 1 minute in accordance with the scaling policy and cooldown settings.

Logs

The logs tab will explain the scaling behavior and actions Elastigroup is taking behind the scenes.Let’s recap

Congrats! You’ve completed your first lab. Time for the next one.