Instance Lifecycle¶
An ECS instance in an AS group goes through different statuses from its creation to its removal.
The instance status changes as shown in Figure 1 if you have not added a lifecycle hook to the AS group.
When trigger condition 2 or 4 is met, the system autonomously puts instances into the next status.
Status | Action | Description | Trigger Condition |
---|---|---|---|
Initial |
| The instance has not been added to the AS group. |
|
Adding | Add the instance. | When trigger condition 1 is met, AS adds the instance to expand the AS group capacity. | The instance status changes to Adding when any of the following conditions occurs:
|
(Optional) Associate the instance with the load balancing listener. | When trigger condition 1 is met, AS associates the instance with the load balancing listener. | ||
Enabled |
| The instance is added to the AS group and starts to process service traffic. |
|
Removing | (Optional) Disassociate the instance from the load balancing listener. | When trigger condition 3 is met, AS disassociates the instance to be removed from the load balancing listener. | The instance status changes from Enabled to Removing when any of the following conditions is met:
|
Remove the instance. | After the instance is dissociated from the load balancing listener, it is removed from the AS group. | ||
Removed |
| The instance lifecycle in the AS group ends. |
|
After an ECS instance is added to an AS group manually or automatically, it goes through different statuses from Adding, Enabled to Removing. Then it is finally removed from the AS group.
If you have added a lifecycle hook to the AS group, the instance lifecycle changes as shown in Figure 2. When a scale-out or scale-in event occurs in the AS group, the required instances are suspended by the lifecycle hook and remain in the wait status until the timeout period ends or you manually call back the instances. You can perform custom operations on the instances when they are in the wait status. For example, you can install or configure software on an instance before it is added to the AS group or download log files from an instance before it is removed.
Under trigger condition 2, 4, 6, or 8, the system automatically changes the instance status.
Status | Action | Description | Trigger Condition |
---|---|---|---|
Initial |
| The instance has not been added to the AS group. |
|
Adding to AS group | Add the instance. | When trigger condition 1 is met, AS adds the instance to expand the AS group capacity. | The instance status changes to Adding when any of the following conditions occurs:
|
Wait (Adding to AS group) |
| The lifecycle hook suspends the instance being added to the AS group and puts the instance into a wait status. | The instance status changes from Wait (Adding to AS group) to Adding to AS group when either of the following conditions occurs:
|
Adding to AS group | (Optional) Associate the instance with a load balancing listener. | When trigger condition 3 is met, AS associates the instance with the load balancing listener. | The instance status changes from Wait (Adding to AS group) to Adding to AS group when either of the following conditions occurs:
|
Enabled |
| The instance is added to the AS group and starts to process service traffic. | The instance status is changed from Enabled to Removing from AS group when any of the following conditions occurs:
|
Removing from AS group | (Optional) Disassociate the instance from the load balancing listener. | When trigger condition 5 is met, the AS group starts to reduce resources and disassociate the instance from the load balancing listener. | The instance status is changed from Enabled to Removing from AS group when any of the following conditions occurs:
|
Wait (Removing from AS group) |
| The lifecycle hook suspends the instance that is being removed from the AS group and puts the instance into a wait status. | The instance status is changed from Wait (Removing from AS group) to Removing from AS group when either of the following conditions occurs:
|
Removing from AS group | Remove the instance. | When trigger condition 7 is met, AS removes the instance from the AS group. | The instance status is changed from Wait (Removing from AS group) to Removing from AS group when either of the following conditions occurs:
|
Removed |
| The instance lifecycle in the AS group ends. |
|
When the instance is added to the AS group manually or through a scaling action, it goes through statuses from Adding to AS group, Wait (Adding to AS group), Adding to AS group, Enabled, Removing from AS group, Wait (Removing from the AS group), to Removing from AS group and is finally removed from the AS group.