DEMO: Automated Scaling Rules
Introduction to Alibaba Auto Scaling
The course is part of this learning path
Alibaba Auto Scaling automatically creates and releases ECS instances based on pre-defined rules in order to scale services to match demand. Furthermore, it can configure server load balancer and relational database service white lists, without any manual intervention.
In this course, you will learn about the Alibaba Auto Scaling service and how it operates. You will learn about the core concepts of the service, scaling groups, scaling configurations, and scaling rules (manual and automatic). For each section of the course, there are guided demonstrations from the Alibaba Cloud platform that you can follow along with, giving you the practical experience necessary to set up auto scaling on your own environment.
If you have any feedback relating to this course, feel free to contact us at firstname.lastname@example.org.
- Understand the core concepts and components of Alibaba Auto Scaling
- Learn how to create, modify, enable, disable, and delete a scaling group
- Learn how to create, modify and delete the scaling configuration that provides the virtual servers in the scaling group
- Understand the different types of scaling rules that are available
- Learn how to use manual and automatic scaling operations
This course is intended for anyone who wants to learn how to set up auto scaling in their Alibaba Cloud environments.
To get the most out of this course, you should already have a basic knowledge of Alibaba Cloud or another cloud vendor.
Hello and welcome to this demonstration on automated scaling rules. In the last demonstration we looked at manual scaling rules and you can see that I'm in the Scaling Rules page for my scaling group. Now to create automated scaling tasks, we're gonna come outside of the scaling group and you'll see in the menu system on the left-hand side we have Scheduled Tasks and Event-triggered Tasks. So we'll start off by creating a scheduled task.
So if I select schedule tasks, I want to create a scheduled task, add two machines or two instances or just call it, Add2instances. I can give a description if I wish, I have to tell it when I want it to be executed. So the current time is 3:33. So what I'm gonna do is select the Current Date and then in the select Time, I'll just add this in for a couple of minutes. So at minute 35 for example, so this will be triggered, this schedule will be triggered in two minutes time, I select the scaling group, I want to be triggered against. So that's my test scaling group and the scaling method is either select an existing scaling rule or I can reconfigure the number of instances in the scaling group. So I want to select an existing scaling rule because this is the add two instances, I'm going to select my add two instance rule from the list.
Now I can give it a retry interval so this is the amount of time or the amount of seconds it will carry on retrying. If it doesn't carry out the schedule the first time around and in the recurrences, if I leave it at not set, it will only schedule once or I can do it by day, by week, by month or a cron expression where we can go down to minutes and hours as well. So I'll leave it as not set and click, Ok. This will create the scheduled task based on the rule, scale rule of adding two instances.
So if I come back into the scaling groups and then select the scaling group itself, I'll wait until the scheduled task is triggered and then come back to the video.
We can see we're now, it's a minute 35, if I refresh the screen, we should see that we now have a task being executed so that was triggered from the schedule. If I go to the scaling activities, you'll see that we have the activity that's being executed which is the add"2"ECS instances.
If I go back to basic information you'll see we're now adding two new ECS instances which will take us up to the total of five and that would be our maximum number of instances allowed in the group. So you can see that task is now finished and we now have a total of five machines and five in-service.
Next, we're gonna look at creating an event-triggered task. So in the menu system, I'll come over to Event-triggered Tasks. So we have select Create Even-triggered task. I give it a name. Now I've already got five machines in the group and that's my maximum.
So what I'm gonna do is set one up to remove one instance, I can put an optional description. I then have to select the scaling group that I want to monitor, so I'll select my test group from the list. I then change or select the monitoring metric.
Now the default is CPU utilization, I could make that memory average system load etc. I'll leave it at CPU utilization. I choose the reference period that I want it to be monitored against. So I've got the option of either one to five or 15 minute time grains, I'll leave it set to one. And I then set the condition.
Now I want to remove instances so instead of the average being greater than or equal to a percentage, I'm gonna set that as less than or equal to a percentage. And in there I'll set that at 70%. So my machines are all running on idle, they don't have a load on them so they all will be running under 70%.
For the condition to be satisfied, I have to trigger the condition after it's happened so many times, the default is three, I'm gonna set that to one. So it only has to happen one time to trigger the condition. And the trigger rule that I'm gonna put into effect is in my rules, we have the remove one instance. So I'm gonna set that to remove one instance.
Now, when I click Ok, it's now created the event-triggered task. Now that event triggered task is going to trigger the remove one instance scaling rule. What I want to do is make sure that my machines are removed evenly. I'm gonna go back to the scaling group and to the scaling group details, go to the Scaling Rules and I'm gonna edit the remove one instance rule because at the moment it has a cool-down time of two minutes which means every two minutes the rule will be triggered as an event. I'm gonna change that for just a little bit of speed to 30 seconds and click Ok.
So the idea now is when that event takes place after 30 seconds, each machine should start to be deleted down to the minimum instance count of two. If I go to scaling activities, you can see I now have a rule that is executing and it is removing one ECS instance.
If I go back to the base information we can see that is executing in the list here. And at the moment, we now had a total of five, we now have foreign services removing one. If I refresh, you'll see that we now have four total foreign service, 30 seconds later, it should trigger again and the next machine will be removed and every 30 seconds it will remove the machine until we get down to the final count of the minimum group count of two. You can see now that the second one is executing and we're getting rid of another machine and we'll be down to three. What I'll do is I'll pause the video at this point and I'll come back to it when we're down to the minimum count of two.
And you can see that we are now in a situation where we have two total machines in service in the group. Now in 30 seconds time, that event is gonna be triggered again but this time it will be rejected because we are already at the minimum instance level counts. And you can see here that the last event has tried to trigger and it has been rejected if we go to the scaling activities, you'll see we now have this rejected and effectively, that will be rejected every 30 seconds from here on in.
That concludes the demonstration for creating automated tasks, we've looked at schedule tasks and event trigger tasks. And the last thing I suppose is if we go back to the scaling groups if I now want to get rid of the scaling group, I can click on the three dots, delete where I'll get the Ok button and it says, it's gonna delete all the rules, I click Ok. And you can see the group has now been deleted.
My scheduled task still remains. My event-triggered task has been deleted and the scaling group and all of its rules and configurations have been deleted. And that concludes the course. I hope it's been informative and thank you for watching.
David’s IT career started in 1990, when he took on the role of Database Administrator as a favor for his boss. He redirected his career into the Client Server side of Microsoft with NT4, and then progressed to Active Directory and each subsequent version of Microsoft Client/Server Operating Systems. In 2007 he joined QA as a Technical Trainer, and has delivered training in Server systems from 2003 to 2016 and Client systems from XP onwards. Currently, David is a Principal Technical Learning Specialist (Cloud), and delivers training in Azure Cloud Computing, specializing in Infrastructure Compute and Storage. David also delivers training in Microsoft PowerShell, and is qualified in the Alibaba Cloud Space.