The health state of an Elastic Compute Service (ECS) instance indicates the health of the instance operating system. You can check the health state of an instance to determine whether the instance is available. For example, you can determine whether the instance can be accessed by using SSH or Remote Desktop Protocol (RDP) based on the health state of the instance. This topic compares the instance health status and lifecycle status and describes how to view the health state of an instance by using the ECS console or by calling an API operation.
Instance health status
The health state of an instance represents the health conditions of the instance operating system, including whether the operating system is running as expected, whether the instance has network connectivity, and whether CPUs or disks perform as expected.
You can monitor the health state of an instance to check whether the operating system of the instance is running as expected.
For example, if the lifecycle state of an instance is Running, it does not mean that the operating system of the instance is running. If the health state of the instance is OK, it indicates that the operating system is running and you can SSH or RDP into the instance.
The health status of instances is updated every minute. You can monitor the health status of instances to check for and handle exceptions in a timely manner.
To be notified of instance health status changes, you can create event-triggered alert rules for instance health status changes. For more information, see Manage system event-triggered alert rules.
The following table compares the instance health status and lifecycle status and describes the use scenarios of each health state and lifecycle state.
Lifecycle state (Lifecycle Status)
Health state (HealthStatus)
Description
Handling method
Starting
Initializing
The instance is being initialized.
Wait for the instance to start.
Running
The operating system of the instance is starting.
Wait for the instance to start.
Running
Impaired
The operating system of the instance is running. However, instance performance may be affected or degraded due to issues with the underlying host, storage, or network.
The operating system of the instance is running. However, the instance encounters a blue screen error or hangs due to an out of memory (OOM) error.
Start or restart the instance for the operating system to operate as expected.
Report the issue to Alibaba Cloud Technical Support.
Running
OK
The operating system of the instance is running, and the instance is not affected by external factors.
No
Stopping/Stopped
InsufficientData
The instance is being stopped or is stopped.
Start the instance.
Deleted
NotApplicable
The lifecycle state of the instance is invalid.
No
View the health state of an instance in the ECS console
Log on to the ECS console.
In the left-side navigation pane, choose .
In the upper-left corner of the top navigation bar, select a region.
Find the instance whose health state you want to view and click the instance ID.
In the upper-right corner of the Instance Details tab, view the health state of the instance.
View the health state of an instance by using Alibaba Cloud CLI
Run the following commands to call the DescribeInstances and DescribeInstancesFullStatus operations to query the health status of specific instances:
aliyun ecs DescribeInstances --RegionId TheRegionId --output cols=InstanceId,InstanceName rows=Instances.Instance[] aliyun ecs DescribeInstancesFullStatus --RegionId TheRegionId --InstanceId.1 i-bp1afnc98r8k69****** --output cols=HealthStatus rows=InstanceFullStatusSet.InstanceFullStatusType[]
Run the following command to call the DescribeInstancesFullStatus operation to query the health status of all instances in a specific region.
For more information about region IDs, see Regions and zones.
aliyun ecs DescribeInstancesFullStatus --RegionId TheRegionId --output cols=HealthStatus rows=InstanceFullStatusSet.InstanceFullStatusType[]
After you submit a health check request, Alibaba Cloud returns the health check result for each instance included in the request.
In the response, HealthStatus indicates the instance health status and Status indicates the instance lifecycle status.
If the instance is healthy, OK is returned for HealthStatus.
If the instance is unhealthy, a different value is returned for HealthStatus.
For more information about the differences between instance health status and lifecycle status and their use scenarios, see the "Instance health status" section of this topic.