Updated on 2023-12-18 GMT+08:00

Health Check

Health Check Methods

A health check removes unhealthy instances from an AS group. Then, AS adds new instances to the AS group so that the number of instances is the same as the expected number. There are two types of AS group health checks.

  • ECS health check: checks ECS instance running status. If an instance is stopped or deleted, it is considered abnormal. ECS health check is the default health check mode for an AS group. The AS group periodically uses the check result to determine the running status of every instance in the AS group. If the health check results show that an instance is unhealthy, AS removes the instance from the AS group.
  • ELB health check: determines ECS instance running status using a load balancing listener. If the AS group uses load balancers, the health check method can also be ELB health check.

    If you add multiple load balancers to an AS group, an ECS instance is considered to be healthy only when all load balancers detect that the instance status is healthy. If any load balancer detects that an instance is unhealthy, the instance will be removed from the AS group.

In both ECS health check and ELB health check modes, AS removes unhealthy instances from the AS group. Whether a removed instance will be deleted depends on how the instance is added to the AS group.

Table 1 Instance removal and deletion rules

Instance Type

Description

Billing Mode

Removed If Unhealthy

Deleted When Removed

Automatically added instances

Instances automatically created and added to an AS group in a scaling action

Pay-per-use

By default, this type of instances is billed on a pay-per-use basis.

Yes

Yes

Yearly/Monthly

The billing mode of an automatically added instance can be manually changed from pay-per-use to yearly/monthly.

Yes

No

Manually added instances

Instances manually created and added to an AS group

Pay-per-use

Yes

No

Yearly/Monthly

Yes

No

If you need to perform custom operations on an instance that is being deleted or created, you can use lifecycle hooks.

Constraints

  • Even when an AS group is disabled, AS still checks the health of instances in the AS group, but does not remove unhealthy instances.
  • AS does not check the health of instances in standby state.