Queries 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 perform a fuzzy search for key pairs. 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 value: 1. |
PageSize | Integer | No | 10 |
The number of entries to return on each page. Maximum value: 50. Default value: 10. |
ResourceGroupId | String | No | rg-amnhr7u7c7hj**** |
The ID of the resource group. 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. Note Resources in the default resource group are displayed in the response regardless of
how this parameter is set.
|
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 have specified tags added, 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. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
PageSize | Integer | 10 |
The number of entries returned per page. |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
The ID of the request. |
PageNumber | Integer | 1 |
The page number of the returned page. |
TotalCount | Integer | 1 |
The total number of key pairs. |
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. |
KeyPairName | String | testKeyPairName |
The name of the key pair. |
KeyPairFingerPrint | String | ABC1234567 |
The fingerprint of the key pair. |
ResourceGroupId | String | rg-amnhr7u7c7hj**** |
The ID of the resource group. |
Tags | Array of Tag |
The tags of the key pair. |
|
Tag | |||
TagValue | String | TestValue |
The tag value of the key pair. |
TagKey | String | TestKey |
The tag key of the key pair. |
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
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeKeyPairsResponse>
<PageNumber>1</PageNumber>
<PageSize>2</PageSize>
<TotalCount>1</TotalCount>
<KeyPairs>
<KeyPair>
<CreationTime>2018-10-10T01:00Z</CreationTime>
<ResourceGroupId/>
<KeyPairName>testKeyPairName</KeyPairName>
<KeyPairFingerPrint>ABC1234567</KeyPairFingerPrint>
</KeyPair>
</KeyPairs>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</DescribeKeyPairsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"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.