Updated on 2022-08-15 GMT+08:00

Instance Lifecycle

The ECS instances in an AS group transitions through different statues from the moment it is created to its removal.

The instance status changes as shown in Figure 1 if you have not added a lifecycle hook to the AS group.
Figure 1 Instance lifecycle
When trigger condition 2 or 4 is met, the system autonomously puts instances into the next status.
Table 1 Instance statuses

Status

Sub-status

Status Description

Trigger Condition

Initial

None

The instance has not been added to the AS group.

The instance status will be changed to Adding to AS group when either of the following occurs:
  • You manually increase the expected number of instances of the AS group.
  • The system automatically expands the AS group capacity.
  • You manually add instances 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.

(Optional) Associate the instance with a load balancing listener.

When trigger condition 1 is met, AS associates the created instance with the load balancing listener.

Enabled

None

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 occurs:
  • You manually decrease the expected number of instances of the AS group.
  • The system automatically removes instances in a scaling action.
  • A health check shows that an enabled instance is unhealthy, and the system removes it from the AS group.
  • You manually remove instances from the AS group.

Removing from AS group

(Optional) Disassociate the instance from the load balancing listener.

When trigger condition 3 is met, the AS group starts to reduce resources and disassociate the instance from the load balancing listener.

Remove the instance.

After the instances are unbound from the load balancing listener, they are removed from the AS group.

Removed

None

The instance lifecycle in the AS group ends.

None

When an ECS instance is added to an AS group manually or through a scaling action, it goes through the Adding to AS group, Enabled, Removing from AS group statuses, and is finally removed from the AS group.

If you have added a lifecycle hook to the AS group, the instance statues change 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.
Figure 2 Instance lifecycle
Under trigger conditions 2, 4, 6, or 8, the system automatically changes the instance status.
Table 2 Instance statuses

Status

Sub-status

Status Description

Trigger Description

Initial

None

The instance has not been added to the AS group.

The instance status is changed to Adding to AS group when either of the following occurs:
  • You manually increase the expected number of instances of an AS group.
  • The system automatically adds instances to the AS group in a scaling action.
  • You manually add instances to the AS group.

Adding to AS group

Add an instance.

When trigger condition 1 is met, AS adds the instance to expand the AS group capacity.

Wait (Adding to AS group)

None

The lifecycle hook suspends the instance that is being added to the AS group and puts the instance into waiting state.

The instance status is changed from Wait (Adding to AS group) to Adding to AS group when either of the following operations is performed:
  • The default callback action is performed.
  • You manually perform the callback action.

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.

Enabled

None

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 occurs:
  • You manually decrease the expected number of instances of an AS group.
  • The system automatically removes instances in a scaling action.
  • A health check shows that the instance is unhealthy after being enabled, and the system removes it from the AS group.
  • You manually remove an instance from an AS group.

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.

Wait (Removing from AS group)

None

The lifecycle hook suspends the instance that is being removed from the AS group and sets the instance to be in waiting state.

The instance status is changed from Wait (Removing from AS group) to Removing from AS group when either of the following occurs:
  • The default callback action is performed.
  • You manually perform the callback action.

Removing from AS group

Remove the instance.

When trigger condition 7 is met, AS removes the instance from the AS group.

Removed

None

The instance lifecycle in the AS group ends.

None