Queries the status of one or more Elastic Compute Service (ECS) instances. You can also call this operation to query the list of ECS instances that match the specified filter conditions.
Operation description
For information about the lifecycle states of an ECS instance, see Instance lifecycle.
Sample requests
Query the ECS instances and the status of the instances in a specific region. Sample request:
"RegionID": "cn-hangzhou"
Query the ECS instances and the status of the instances in a zone of a specific region. Sample request:
"RegionID": "cn-hangzhou",
"ZoneID": "cn-hangzhou-a"
Query the status of an ECS instance in a specific region based on the instance ID. Sample request:
"RegionID": "cn-hangzhou",
"InstancesID": ["i-bp1f7c1zqp999zvp****", "i-bp1dqjv36biueg61****"]
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:DescribeInstanceStatus |
list |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the instances. You can call the DescribeRegions operation to query the most recent region list. |
cn-hangzhou |
| ZoneId |
string |
No |
The zone ID of the instances. You can call the DescribeZones operation to query the most recent zone list. |
cn-hangzhou-d |
| ClusterId |
string |
No |
The ID of the cluster to which the ECS instances belong. Note
This parameter is deprecated. We recommend that you do not use this parameter. |
cls-bp67acfmxazb4p**** |
| PageNumber |
integer |
No |
The page number. Pages start from page 1. Default value: 1. |
1 |
| PageSize |
integer |
No |
The number of entries per page. Valid values: 1 to 50. Default value: 10. |
10 |
| InstanceId |
array |
No |
The IDs of ECS instances. You can specify 1 to 100 instance IDs. Example: ["i-bp1j4i2jdf3owlhe****", "i-bp1j4i2jdf3o1234****"]. |
i-bp1j4i2jdf3owlhe**** |
|
string |
No |
The ID of the ECS instance. |
i-bp1j4i2jdf3owlhe**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| PageSize |
integer |
The number of entries per page. |
1 |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| PageNumber |
integer |
The page number. |
1 |
| TotalCount |
integer |
The total number of instances. |
58 |
| InstanceStatuses |
object |
||
| InstanceStatus |
array<object> |
The IDs and status of the ECS instances. |
|
|
object |
|||
| Status |
string |
The status of the instance. Valid values:
|
Running |
| InstanceId |
string |
The ID of the instance. |
i-bp1j4i2jdf3owlhe**** |
Examples
Success response
JSON format
{
"PageSize": 1,
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"PageNumber": 1,
"TotalCount": 58,
"InstanceStatuses": {
"InstanceStatus": [
{
"Status": "Running",
"InstanceId": "i-bp1j4i2jdf3owlhe****"
}
]
}
}
Error response
JSON format
{
"RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
"TotalCount": 2,
"PageNumber": 1,
"PageSize": 10,
"InstanceStatuses": {
"InstanceStatus": [{
"InstanceId": "i-instance1",
"Status": "Running"
},
{
"InstanceId": "i-ae4r89pp",
"Status": "Stopped"
}]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 403 | InvalidParameter.TooManyInstanceIds | Instance ids cannot be more than 100. | InstanceIds cannot be more than 100. |
| 403 | Abs.InvalidInstanceIds.MalFormed | The specified instanceIds is not valid. | |
| 404 | InvalidZoneId.NotFound | The ZoneId provided does not exist in our records. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.