AS automatically adds instances to an AS group for applications when necessary and removes extra ones when unnecessary. In this way, you do not need to prepare a large number of ECSs for an expected marketing activity or unexpected peak hours, thereby ensuring system reliability and reducing system operating costs.
This section describes how to use services, such as AS, ECS, ELB, and VPC to deploy a web service that can be automatically scaled in and out, for example, the Discuz forum.
Create an ECS and install the MySQL database on it.
You can create a relational database using the Relational Database Service (RDS) service provided by the cloud platform, or create an ECS and install the database on it. In this section, install the MySQL database on a newly created ECS.
You can access the MySQL database through a private network. Therefore, the EIP bound to the ECS where the MySQL database is installed can be unbound and then bound to the ECS where the Discuz forum is to be deployed. This improves resource utilization. For detailed operations, see Virtual Private Cloud User Guide. After the binding, you can access the ECS through the Internet and install environments, such as PHP and Apache, on the ECS.
For instructions about how to deploy the Discuz forum, see officially released Discuz documents. When configuring parameters, configure the private IP address of the ECS where the MySQL database is installed for the database server; use the username and password authorized for remotely accessing the ECS where the MySQL database is installed to access the MySQL database. After the configuration, you can unbind the EIP from the ECS where the forum is deployed to reduce resource usage.
Create a private image.
Create an AS group.
An AS group consists of a collection of ECSs, AS configurations, and AS policies that have similar attributes and apply to the same application scenario. An AS group is the basis for enabling or disabling AS policies and performing scaling actions. You must create an AS group to automatically increase or decrease the number of ECSs to match the Discuz forum traffic change.
For instructions about how to create an AS group, see section Creating an AS group. During the configuration, use the created VPC, subnet, load balancer, and listener.
Create an AS configuration.
The AS configuration lists the basic specifications of the ECSs to be automatically added to the AS group in a scaling action.
For instructions about how to create an AS configuration, see section Using a New Specifications Template to Create an AS Configuration. During the configuration, select the private image you have created in the preceding step. Configure other parameters based on service requirements.
Manually add the ECS to the AS group.
On the page providing details about the AS group, click the Instance tab and then Add to add the ECS where the Discuz forum is deployed to the AS group. For details, see section Manually Expanding Resources. You can enable instance protection on this ECS so that it will not be automatically removed from the AS group.
Create an AS policy.
An AS policy specifies the conditions for triggering a scaling action. After you create an AS policy for the AS group, AS automatically increases or decreases the number of instances based on the AS policy.
You can configure an alarm-triggered AS policy. When Cloud Eye generates an alarm for a monitoring metric, such as CPU usage, AS automatically increases or decreases the number of instances in the AS group. To suit predictable traffic needs, you can also configure a scheduled or periodic AS policy to expand resources.
For instructions about how to create an AS policy, see sections Dynamically Expanding Resources and Expanding Resources as Planned. After an AS policy is created and enabled and when the trigger condition is met, the AS group scales up or down.