Queries instances of a service.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
eas:ListServiceInstances | get | *Service acs:eas:{#regionId}:{#accountId}:service/{#ServiceName} |
| none |
Request syntax
GET /api/v2/services/{ClusterId}/{ServiceName}/instances HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ClusterId | string | Yes | The ID of the region where the service is deployed. | cn-shanghai |
ServiceName | string | Yes | The service name. For more information about how to query the service name, see ListServices . | foo |
PageNumber | integer | No | The page number. Default value: 1. | 1 |
PageSize | integer | No | The number of entries per page. Default value: 100. | 20 |
Filter | string | No | The keyword used to query instances. Instances can be queried based on instance name, instance IP address, IP address of the server where the instance resides, and instance type. | 10.118.xx.xx |
ResourceType | string | No | The type of the resource group to which the instance belongs. Valid values:
| PublicResource |
InstanceType | string | No | The instance type. | ecs.c7.large |
InstanceStatus | string | No | The instance state. | Running |
InstanceIP | string | No | The IP address of the instance. | 10.224.xx.xx |
InstanceName | string | No | The instance name. | foo-bdc5xxxx-8l7rk |
HostIP | string | No | The IP address of the server where the instance resides. | 10.224.xx.xx |
IsSpot | boolean | No | Specifies whether the instance is a preemptible instance. | false |
Role | string | No | The service role. Valid values:
| Queue |
Sort | string | No | The field that you use to sort the query results.
| StartTime |
Order | string | No | The sorting order. Valid values:
| desc |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "40325405-579C-4D82****",
"Instances": [
{
"HostIP": "11.0.XX.XX",
"HostName": "smart-scene-cls-854dbdc99d-****",
"InnerIP": "172.17.0.17",
"InstanceName": "foo-5fc8946767-v****",
"InstancePort": 8080,
"LastState": [
[]
],
"Namespace": "foo",
"Reason": "RUNNING",
"RestartCount": 1,
"Status": "Running",
"TotalProcesses": 1,
"ReadyProcesses": 1,
"StartAt": "2021-05-27T09:46:05Z",
"Role": "Standard",
"ResourceType": "PublicResource",
"TenantInstanceIP": "192.168.xx.xx",
"TenantHostIP": "192.168.xx.xx",
"IsSpot": false,
"CurrentAmount": 0.444,
"OriginalAmount": 2.2,
"Isolated": false,
"Zone": "cn-shanghai-a",
"ExternalIP": "192.168.1.100",
"ExternalInstancePort": 8080,
"StartTime": "2021-05-27T09:46:05Z"
}
],
"PageNumber": 1,
"PageSize": 20,
"TotalCount": 1
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-05-06 | The request parameters of the API has changed | View Change Details |