Queries a list of instances.
Operation Description
You can use one of the following methods to check the response:
Method 1: Use MaxResults to specify the number of entries per page. Then, use NextToken to specify the token that is used to display the next page. NextToken is set to the value that is returned from the most recent call of the DescribeDBInstances operation for NextToken.
NoteThe first time you call the DescribeDBInstances operation to perform a paged query, you need only to specify MaxResults. In this case, the operation returns the data of the first page and the value of NextToken.Method 2: Use PageSize to specify the number of entries per page. Then, use PageNumber to display the next page.
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 |
---|---|---|---|---|
rds:DescribeDBInstances | READ |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. | ETnLKlblzczshOTUbOCzxxxxxxx |
proxyId | string | No | The ID of the proxy mode. | API |
Engine | string | No | The database engine of the instance. Valid values:
By default, this operation returns the instances that run any of the supported database engines. | MySQL |
ZoneId | string | No | The zone ID of the instance. | cn-hangzhou-a |
ResourceGroupId | string | No | The ID of the resource group. | rg-acfmyxxxxx |
DBInstanceStatus | string | No | The status of the instance. For more information, see Instance states. | Running |
Expired | string | No | Specifies whether to query instances that have expired. Valid values:
| True |
SearchKey | string | No | The keyword that is used for fuzzy search. The keyword can be part of an instance ID or an instance description. | rm-uf6w |
DBInstanceId | string | No | The ID of the instance. You can call the DescribeDBInstances operation to query the ID of the instance. | rm-uf6wjk5xxxxxxx |
DBInstanceType | string | No | The role of the instance. Valid values:
By default, this operation returns the instances that assume any of the supported roles. | Primary |
RegionId | string | Yes | The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
PageSize | integer | No | The number of entries to return on each page. Valid values: 1 to 100. Default value: 30. | 30 |
PageNumber | integer | No | The number of the page to return. Valid values: any non-zero positive integer. Default value: 1. | 1 |
InstanceNetworkType | string | No | The network type of the instance. Valid values:
By default, this operation returns the instances that reside in any of the supported network types. | Classic |
VpcId | string | No | The VPC ID of the instance. | vpc-uf6f7l4fg90xxxxxxxxxx |
VSwitchId | string | No | The vSwitch ID of the instance. | vsw-uf6adz52c2pxxxxxxxxxx |
DBInstanceClass | string | No | The instance type of the instance. For information, see Primary ApsaraDB RDS instance types. | rds.mys2.small |
EngineVersion | string | No | The database engine version of the instance. | 5.7 |
PayType | string | No | The billing method of the instance. Valid values:
| Postpaid |
ConnectionMode | string | No | The connection mode of the instance. Valid values:
By default, this operation queries the instances that use any of the supported connection modes. | Standard |
Tags | string | No | The tag that is added to the instance. Each tag is a key-value pair that consists of two fields: TagKey and TagValue. You can specify a maximum of five tags in the following format for each request: {"key1":"value1","key2":"value2"...}. | {"key1":"value1"} |
DedicatedHostGroupId | string | No | The ID of the dedicated cluster. | dhg-7a9xxxxxxxx |
DedicatedHostId | string | No | The host ID of the instance in the dedicated cluster. | i-bpxxxxxxx |
InstanceLevel | integer | No | Specifies whether to return the RDS edition of the instance by using the Category parameter. Valid values:
| 0 |
ConnectionString | string | No | The endpoint of the instance. You must specify this parameter only when you want to query a single instance. | rm-uf6wjk5xxxxxxx.mysql.rds.aliyuncs.com |
NextToken | string | No | The token that is used to display the next page. You must set this parameter to the value that is returned from the most recent call of the DescribeDBInstances operation for NextToken. If the returned entries are displayed on multiple pages, the next page can be displayed when you call this operation again with this parameter specified. | o7PORW5o2TJg********** |
MaxResults | integer | No | The number of entries to return per page. Valid values: 1 to 100. Default value: 30. NoteIf you specify this parameter, PageSize and PageNumber are unavailable. | 30 |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "1AD222E9-E606-4A42-BF6D-8A4442913CEF",
"PageNumber": 1,
"PageRecordCount": 10,
"TotalRecordCount": 100,
"Items": {
"DBInstance": [
{
"VpcId": "vpc-uf6f7l4fg90xxxxxxx",
"DedicatedHostIdForLog": "dh-bpxxxx",
"CreateTime": "2018-11-05T11:26:02Z",
"PayType": "Postpaid",
"DedicatedHostNameForLog": "testlog",
"MutriORsignle": true,
"DedicatedHostGroupName": "testhostgroup",
"EngineVersion": "5.7",
"DedicatedHostGroupId": "dhg-7a9xxxxxxxx",
"VpcName": "test-huadong",
"DedicatedHostZoneIdForMaster": "cn-hangzhou-c",
"ConnectionString": "rm-uf6wjk5xxxxxxx.mysql.rds.aliyuncs.com",
"InstanceNetworkType": "Classic",
"MasterInstanceId": "rm-uf6wjk5xxxxxxxxxx",
"ExpireTime": "2019-02-27T16:00:00Z",
"DestroyTime": "2018-11-05T11:26:02Z",
"GuardDBInstanceId": "rm-uf64zsuxxxxxxxxxx",
"DedicatedHostNameForMaster": "testmaster",
"ZoneId": "cn-hangzhou-a",
"TipsLevel": 1,
"DBInstanceId": "rm-uf6wjk5xxxxxxxxxx",
"DedicatedHostIdForMaster": "dh-bpxxxx",
"TempDBInstanceId": "rm-uf64zsuxxxxxxxxxx",
"DBInstanceStorageType": "ModuleList.4.ModuleCode",
"ConnectionMode": "Standard",
"LockMode": "Unlock",
"GeneralGroupName": "TestGroup",
"VpcCloudInstanceId": "rm-uf6wjk5xxxxxxx",
"DedicatedHostZoneIdForSlave": "cn-hangzhou-d",
"Tips": "Run as expected.\n",
"DedicatedHostZoneIdForLog": "cn-hangzhou-b",
"DedicatedHostNameForSlave": "testslave",
"DBInstanceDescription": "Test database\n",
"DBInstanceNetType": "Internet",
"DBInstanceType": "Primary",
"LockReason": "instance_expired",
"DBInstanceStatus": "Running",
"RegionId": "cn-hangzhou",
"VSwitchId": "vsw-uf6adz52c2pxxxxxxx",
"DedicatedHostIdForSlave": "dh-bpxxxx",
"ResourceGroupId": "rg-acfmyxxxxxxx",
"Category": "Basic",
"Engine": "MySQL",
"DBInstanceClass": "rds.mys2.small",
"SwitchWeight": 100,
"ReadOnlyDBInstanceIds": {
"ReadOnlyDBInstanceId": [
{
"DBInstanceId": "rr-uf6wjk5xxxxxxx"
}
]
},
"DeletionProtection": false
}
]
},
"NextToken": "o7PORW5o2TJg**********"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | Invalid.NextToken | The parameter NextToken is invalid. | The specified NextToken is invalid. |
400 | InvalidDBInstanceType.ValueNotSupport | The specified parameter DBInstanceType is not valid. | - |
400 | InvalidParameter.OwnerAccount | The specified parameter OwnerAccount is not valid. | The operation failed. The value of the OwnerAccount parameter is invalid. Check the value of this parameter. |
400 | TimeoutRetryLater | Timeout, Please retry later. | - |
400 | InvalidExpired.Format | The instance expiration status parameter is incorrect. | The parameter that specifies the instance expiration status is invalid. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
2023-05-26 | The error codes of the API operation change.,The input parameters of the API operation change.,The response structure of the API operation changes. | |||||||||||
| ||||||||||||
2023-05-15 | The error codes of the API operation change. | |||||||||||
| ||||||||||||
2023-05-11 | The error codes of the API operation change.,The input parameters of the API operation change. | |||||||||||
| ||||||||||||
2022-09-01 | The error codes of the API operation change. | |||||||||||
| ||||||||||||
2022-06-24 | API Description Update,The error codes of the API operation change. | |||||||||||
| ||||||||||||
2021-10-11 | The error codes of the API operation change.,The response structure of the API operation changes. | |||||||||||
|