This article briefly introduces AWS's auto scaling and related concepts to give readers a basic understanding of the auto scaling service.
Summary
Auto Scaling (AS) is designed to help users increase or decrease Virtual Machine services to maximize system usage and minimize costs.
Main usage scenarios: You need to create a cluster to provide external database services, and want to increase the number of nodes when the access traffic is large. When the access traffic is small, the number of nodes is reduced. At night, the number of nodes is reduced, increase the number of nodes during the day, and ensure that the number of healthy nodes is 5.
As will manage the cluster according to the above requirements, and make corresponding actions on the virtual machines in the cluster when the conditions are met. For example, when an as node in the cluster is abnormal, to ensure that the number of healthy nodes is 5, it automatically creates a virtual machine and monitors its status. In this way, you do not have to worry about cluster management, so that the as can intelligently manage the entire cluster.
Glossary
Auto scaling group
It can be understood as a cluster, which contains many virtual machines with similar configurations. As will maintain the status of this group.
Health Check
As performs the action based on the health status of the virtual machine. As will regularly check the status of the Virtual Machine. if it finds that the status of the virtual machine is not running, it will think that the virtual machine is "unhealthy" and it will delete the virtual machine, create a new virtual machine to replace the unhealthy virtual machine.
Launch Configuration
Run the configuration to define the virtual machine parameters. As uses these parameters to start the virtual machine. For example, if you specify an image ID, the instance type is m1.small, and the security group rule is SG-aaa.
Policy
The Response Policy defines some column actions that will be triggered after the as receives a cloudwatch warning message. For example, if the CPU usage of a VM sent by cloudwatch exceeds 80%, a virtual machine is created. After receiving the cloudwatch message, as will automatically create a virtual machine.
Availability zones and regions
AWS classifies Disaster Tolerance for virtual machines into two levels: Availability zones and regions. The former is geographically isolated, and the latter is engineering isolation. It can be simply understood that the former is the highest level of disaster tolerance, while the latter is a low-cost disaster tolerance. A cluster can only be in one regions, but many availability zones can be created. As will distribute virtual machines in each zone as much as possible. If it finds that a zone is unavailable, to meet the cluster setting requirements, it selects other suitable zones to create virtual machines to ensure the normal operation of the cluster.
Elastic Load balancer (ELB)
As allows you to use Server Load balancer as the service portal of the cluster. Create a Server Load balancer instance before creating a cluster, and specify the ELB instance used when defining the auto scaling group. Then, as will add all cluster virtual machines to this (some) ELB backend.
General Usage
1. Create launch Configuration:
In this process, you must specify the image ID and specification of the virtual machine. You can also specify the configuration parameters used when starting virtual machines, such as Mount volumes, security groups, and user-data.
2. Create auto scaling group:
To set a cluster, you must use the launch configuration set in step 1 and specify the minimum number of nodes, the maximum number of nodes, the type of security check, and whether Server Load balancer is required.
After completing the preceding two steps, you can set up a cluster and then wait for the as to create an ideal cluster for you.
Control cluster size
There are three ways to control the cluster size: manual, timing, and policy.
Manual: run the modify command directly, for example, "Modify cluster size to 10", "increase by 1%", and "cluster size + 1".
Scheduled: change the number of clusters in a certain period of time. For example, "the number of clusters from to is 5, and the number of clusters from to is 10"
Policy: You need to work with cloudwatch to precisely control the number of clusters. For example, if the CPU usage of the cluster monitored by cloudwatch continues to exceed 80%, then the node is increased. This method is described in detail below.
Linkage with cloudwatch
Cloudwatch is used to monitor the status of a virtual machine, such as CPU usage, memory usage, inbound network, and outbound network. You can also set alarm. For example, if the CPU usage of a virtual machine is greater than 80% and lasts for 10 minutes, an alarm is triggered and cloudwatch sends an email to the Administrator, or send it to.
Associate with cloudwatch. First, create an auto scaling group, then create an alarm corresponding to this group in cloudwatch, and set the corresponding policy in. In this way, when cloudwatch triggers alarm, as will execute the command in the policy.
Example: Set auto scaling Group: Group-1, and then set the CPU usage of group-1 to 80% in cloudwatch within 10 minutes, then an alarm is triggered to notify the as policy, this policy adds a virtual machine. Correspondingly, you can also set to reduce the number of virtual machines when the CPU usage of group-1 continues to be less than 10%.
Refer:
Http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/US_BasicSetup.html
Http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/Welcome.html
Http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/US_SetUpASLBApp.html