You can call this operation to query one or more key pairs.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeKeyPairs |
The operation that you want to perform. Set the value to DescribeKeyPairs. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the key pair. You can call the DescribeRegions operation to query the most recent region list. |
KeyPairName | String | No | *SshKey* |
The name of the key pair. You can use the asterisk (*) symbol as a wildcard in regular expressions to query key pairs by performing a fuzzy search. Sample patterns:
|
KeyPairFingerPrint | String | No | ABC1234567 |
The fingerprint of the key pair. The message-digest algorithm 5 (MD5) is used based on the public key fingerprint format defined in RFC 4716. For more information, see RFC 4716. |
PageNumber | Integer | No | 1 |
The number of the page to return. Pages start from page 1. Default: 1 |
PageSize | Integer | No | 10 |
The number of entries to return on each page. Valid values: 1 to 50. Default value: 10 |
Tag.N.Key | String | No | TestKey |
The key of tag N of the key pair. Valid values of N: 1 to 20. If a single tag is specified to query resources, up to 1,000 resources that are bound with this tag can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that are bound with all these tags can be displayed in the response. To query more than 1,000 resources that are bound with specified tags, call the ListTagResources operation. |
Tag.N.Value | String | No | TestValue |
The value of tag N of the key pair. Valid values of N: 1 to 20. |
ResourceGroupId | String | No | rg-amnhr7u7c7hj**** |
The ID of the resource group to which the key pair belongs. If this parameter is specified to query resources, up to 1,000 resources that belong to the specified resource group can be displayed in the response. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
KeyPairs | Array of KeyPair |
Details about the key pairs. |
|
KeyPair | |||
CreationTime | String | 2019-12-04T13:35:00Z |
The time when the key pair was created. |
KeyPairFingerPrint | String | ABC1234567 |
The fingerprint of the key pair. |
KeyPairName | String | testKeyPairName |
The name of the key pair. |
ResourceGroupId | String | rg-amnhr7u7c7hj**** |
The ID of the resource group to which the key pair belongs. |
Tags | Array of Tag |
The tags of the key pair. |
|
Tag | |||
TagKey | String | TestKey |
The tag key of the key pair. |
TagValue | String | TestValue |
The tag value of the key pair. |
PageNumber | Integer | 1 |
The page number of the returned page. |
PageSize | Integer | 10 |
The number of entries returned per page. |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
The ID of the request. |
TotalCount | Integer | 1 |
The total number of key pairs. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=DescribeKeyPairs
&RegionId=cn-qingdao
&KeyPairFingerPrint=ABC1234567
&KeyPairName=SshKey
&PageNumber=1
&PageSize=20
&<Common request parameters>
Sample success responses
XML
format
<DescribeKeyPairsResponse>
<PageNumber>1</PageNumber>
<PageSize>2</PageSize>
<TotalCount>1</TotalCount>
<KeyPairs>
<KeyPair>
<CreationTime>2018-10-10T01:00Z</CreationTime>
<ResourceGroupId></ResourceGroupId>
<KeyPairName>testKeyPairName</KeyPairName>
<KeyPairFingerPrint>ABC1234567</KeyPairFingerPrint>
</KeyPair>
</KeyPairs>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</DescribeKeyPairsResponse>
JSON
format
{
"PageNumber": 1,
"PageSize": 2,
"TotalCount": 1,
"KeyPairs": {
"KeyPair": [{
"CreationTime": "2018-10-10T01:00Z",
"ResourceGroupId": "",
"KeyPairName": "testKeyPairName",
"KeyPairFingerPrint": "ABC1234567"
}]
},
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
For a list of error codes, visit the API Error Center.