Queries managed instances.
Usage notes
You can use one of the following methods to check the responses:
- Method 1: When you call the DescribeInstances operation to retrieve the first page of results during a paged query, use
MaxResults
to specify the maximum number of entries to return in the call. The return value ofNextToken
is a pagination token, which you can use in the next request to retrieve a new page of results. When you call the DescribeInstances operation to retrieve a new page of results, setNextToken
to theNextToken
value returned in the previous call and useMaxResults
to specify the maximum number of entries to return in the call. - Method 2: Use
PageSize
to specify the number of entries to return on each page, and then usePageNumber
to specify the number of the page to return. You can use only one of the preceding methods. If you specifyMaxResults
orNextToken
, thePageSize
andPageNumber
request parameters do not take effect and theTotalCount
response parameter is invalid.
Debugging
Request parameters
Parameter |
Type |
Required |
Example |
Description |
Action | String | Yes | DescribeManagedInstances | The operation that you want to perform. Set the value to DescribeManagedInstances. |
RegionId | String | Yes | cn-hangzhou | The region ID of the managed instance. Supported regions: China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), China (Hong Kong), Singapore, Japan (Tokyo), US (Silicon Valley), and US (Virginia). You can call the DescribeRegions operation to query the most recent region list. |
OsType | String | No | windows | The operating system type of the managed instance. Valid values:
|
InstanceIp | String | No | 192.168.**.** | The private or public IP address of the managed instance. |
ActivationId | String | No | 4ECEEE12-56F1-4FBC-9AB1-890F7494**** | The activation code ID. |
InstanceName | String | No | my-webapp-server | The name of the managed instance. |
PageNumber | Long | No | 1 | The page number. Pages start from page 1. Default value: 1. |
PageSize | Long | No | 10 | The number of entries per page. Valid values: 1 to 50. Default value: 10. |
InstanceId.N | String | No | mi-hz018jrc1o0**** | The ID of managed instance N. Valid values of N: 1 to 50. |
Tag.N.Key | String | No | TestKey | The key of tag N of the managed instance. Valid values of N: 1 to 20. The tag key cannot be an empty string. If you specify a single tag to query resources, up to 1,000 resources to which the tag is added can be displayed in the response. If you specify multiple tags to query resources, up to 1,000 resources to which the tags are added can be displayed in the response. To query more than 1,000 resources to which specified tags are added, call the ListTagResources operation. The tag key can be up to 64 characters in length and cannot contain |
Tag.N.Value | String | No | TestValue | The value of tag N of the managed instance. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain |
MaxResults | Integer | No | 10 | The maximum number of entries per page. Valid values: 1 to 50. Default value: 10. |
NextToken | String | No | AAAAAdDWBF2**** | The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken. |
ResourceGroupId | String | No | rg-123****** | The ID of the resource group to which the managed instance belongs. |
Response parameters
Parameter |
Type |
Example |
Description |
PageSize | Long | 10 | The number of entries per page. |
RequestId | String | 77115469-F2C5-4ECA-94F7-FA04F2FD**** | The ID of the request. |
PageNumber | Long | 1 | The page number. |
TotalCount | Long | 1 | The total number of queried managed instances. |
Instances | Array of Instance | The queried managed instances. |
|
LastInvokedTime | String | 2021-01-20T09:00:40Z | The time when the Cloud Assistant task was last executed. |
Connected | Boolean | true | Indicates whether the managed instance is connected. Valid values:
|
InternetIp | String | 40.65.**.** | The public IP address of the managed instance. |
Hostname | String | demo | The hostname of the managed instance. |
InstanceId | String | mi-hz018jrc1o0**** | The ID of the managed instance. |
ActivationId | String | 3704F543-F768-43FA-9864-897F75B3**** | The activation code ID. |
IntranetIp | String | 10.0.**.** | The private IP address of the managed instance. |
AgentVersion | String | 2.2.0.102 | The version number of Cloud Assistant Agent. |
RegistrationTime | String | 2021-01-20T08:57:56Z | The time when the managed instance was registered. |
InstanceName | String | webAPP-linux-01 | The name of the managed instance. |
OsType | String | Linux | The operating system type of the managed instance. |
OsVersion | String | Linux_#38~18.04.1-Ubuntu SMP Wed Jan 6 18:26:30 UTC 2021_x86_64 | The version information of the operating system. |
InvocationCount | Long | 1 | The number of times that Cloud Assistant tasks were executed on the managed instance. |
MachineId | String | e03231b37ab14e53b5795ad625fc**** | The machine code of the managed instance. |
Tags | Array of Tag | The tags of the managed instance. |
|
TagKey | String | TestKey | The tag key of the managed instance. Valid values of N: 1 to 20. The tag key cannot be an empty string. If a single tag is specified to query resources, up to 1,000 resources to which the tag is added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources to which the tags are added can be displayed in the response. To query more than 1,000 resources to which specified tags are added, call the ListTagResources operation. The tag key can be up to 64 characters in length and cannot contain |
TagValue | String | TestValue | The tag value of the managed instance. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain |
ResourceGroupId | String | rg-123****** | The ID of the resource group to which the managed instance belongs. |
NextToken | String | AAAAAdDWBF2 | The query token returned in the call. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=DescribeManagedInstances
&RegionId=cn-hangzhou
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeManagedInstancesResponse>
<Instances>
<MachineId>e03231b37ab14e53b5795ad625fc****</MachineId>
<InstanceId>mi-hz018jrc1o0****</InstanceId>
<AgentVersion>2.2.0.102</AgentVersion>
<Connected>true</Connected>
<InvocationCount>1</InvocationCount>
<OsVersion>Linux_#38~18.04.1-Ubuntu SMP Wed Jan 6 18:26:30 UTC 2021_x86_64</OsVersion>
<ActivationId>3704F543-F768-43FA-9864-897F75B3****</ActivationId>
<Hostname>demo</Hostname>
<RegistrationTime>2021-01-20T08:57:56Z</RegistrationTime>
<IntranetIp>10.0.**.**</IntranetIp>
<InstanceName>webAPP-linux-01</InstanceName>
<InternetIp>40.65.**.**</InternetIp>
<OsType>Linux</OsType>
<LastInvokedTime>2021-01-20T09:00:40Z</LastInvokedTime>
</Instances>
<TotalCount>1</TotalCount>
<RequestId>77115469-F2C5-4ECA-94F7-FA04F2FDC8F4</RequestId>
<PageSize>10</PageSize>
<PageNumber>1</PageNumber>
</DescribeManagedInstancesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Instances" : [ {
"MachineId" : "e03231b37ab14e53b5795ad625fc****",
"InstanceId" : "mi-hz018jrc1o0****",
"AgentVersion" : "2.2.0.102",
"Connected" : true,
"InvocationCount" : 1,
"OsVersion" : "Linux_#38~18.04.1-Ubuntu SMP Wed Jan 6 18:26:30 UTC 2021_x86_64",
"ActivationId" : "3704F543-F768-43FA-9864-897F75B3****",
"Hostname" : "demo",
"RegistrationTime" : "2021-01-20T08:57:56Z",
"IntranetIp" : "10.0.**.**",
"InstanceName" : "webAPP-linux-01",
"InternetIp" : "40.65.**.**",
"OsType" : "Linux",
"LastInvokedTime" : "2021-01-20T09:00:40Z"
} ],
"TotalCount" : 1,
"RequestId" : "77115469-F2C5-4ECA-94F7-FA04F2FDC8F4",
"PageSize" : 10,
"PageNumber" : 1
}
Error codes
HttpCode |
Error code |
Error message |
Description |
400 | RegionId.ApiNotSupported | The api is not supported in this region. | You cannot perform this operation in the specified region. Check whether the value of RegionId is valid. |
400 | InvalidParam.PageNumber | The specified parameter is invalid. | Invalid PageNumber value. |
400 | InvalidParam.PageSize | The specified parameter is invalid. | Invalid PageSize value. |
400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | Invalid Tag.N.Key value. |
400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | Invalid Tag.N.Value value. |
400 | NumberExceed.Tags | The Tags parameter number is exceed. | The number of tags exceeds the upper limit. |
400 | MissingParameter.TagKey | You must specify Tag.N.Key. | Tag.N.Key is required. |
400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | The tag key already exists. Tag keys must be unique. |
400 | InvalidParameter.NextToken | The specified parameter NextToken is not valid. | Invalid NextToken value. |
400 | InvalidParameter.MaxResults | The specified parameter MaxResults is not valid. | Invalid MaxResults value. |
403 | Operation.Forbidden | The operation is not permitted. | The operation is not supported. |
500 | InternalError.Dispatch | An error occurred when you dispatched the request. | An error occurred when the request was being sent. Try again later. |
For a list of error codes, see Service error codes.