Queries one or more key pairs.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:DescribeKeyPairs |
get |
KeyPair
KeyPair
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the key pairs. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| KeyPairName |
string |
No |
The name of the key pair. You can use regular expressions for fuzzy search, with the asterisk (*) to match child table expressions. Examples:
|
*SshKey* |
| KeyPairFingerPrint |
string |
No |
The fingerprint of the key pair. The fingerprint uses the message-digest algorithm 5 (MD5) based on the public key fingerprint format defined in RFC 4716. For more information, see RFC 4716. |
ABC1234567 |
| PageNumber |
integer |
No |
The page number of the key pair list. Minimum value: 1. Default value: 1. |
1 |
| PageSize |
integer |
No |
The number of entries per page in paging queries. Settings: Maximum value: 50. Default value: 10. |
10 |
| IncludePublicKey |
boolean |
No |
Specifies whether to include PublicKey in the response. Default value: false. |
false |
| ResourceGroupId |
string |
No |
The ID of the resource group to which the key pairs belong. When you use this parameter to filter resources, the resource count cannot exceed 1000. Note
Filtering by the default resource group is not supported. |
rg-amnhr7u7c7hj**** |
| Tag |
array<object> |
No |
The tags. |
|
|
object |
No |
|||
| Key |
string |
No |
The tag key of the key pair. Valid values of N: 1 to 20. If you use a single tag to filter resources, the resource count with the specified tag cannot exceed 1000. If you use multiple tags to filter resources, the resource count of resources that are attached with all specified tags cannot exceed 1000. If the resource count exceeds 1000, call the ListTagResources operation to query resources. |
TestKey |
| Value |
string |
No |
The tag value of the key pair. Valid values of N: 1 to 20. |
TestValue |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| PageSize |
integer |
The number of entries per page. |
10 |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| PageNumber |
integer |
The current page number. |
1 |
| TotalCount |
integer |
The total number of key pairs. |
1 |
| KeyPairs |
object |
||
| KeyPair |
array<object> |
The key pair information. |
|
|
array<object> |
|||
| CreationTime |
string |
The time when the key pair was created. |
2023-09-04T08:33Z |
| KeyPairName |
string |
The name of the key pair. |
testKeyPairName |
| KeyPairFingerPrint |
string |
The fingerprint of the key pair. |
ABC1234567 |
| ResourceGroupId |
string |
The ID of the resource group. |
rg-amnhr7u7c7hj**** |
| PublicKey |
string |
The content of the public key. |
ssh-rsa**** |
| Tags |
object |
||
| Tag |
array<object> |
The tags of the key pair. |
|
|
object |
|||
| TagValue |
string |
The tag value of the key pair. |
TestValue |
| TagKey |
string |
The tag key of the key pair. |
TestKey |
Examples
Success response
JSON format
{
"PageSize": 10,
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"PageNumber": 1,
"TotalCount": 1,
"KeyPairs": {
"KeyPair": [
{
"CreationTime": "2023-09-04T08:33Z",
"KeyPairName": "testKeyPairName",
"KeyPairFingerPrint": "ABC1234567",
"ResourceGroupId": "rg-amnhr7u7c7hj****",
"PublicKey": "ssh-rsa****",
"Tags": {
"Tag": [
{
"TagValue": "TestValue",
"TagKey": "TestKey"
}
]
}
}
]
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.