| Did this page help you? Yes No Tell us about it... |
Returns information about key pairs available to you. If you specify key pairs, information about those key pairs is returned. Otherwise, information for all your key pairs is returned.
You can filter the results to return information only about key pairs that match criteria you specify. For example, you could filter the results to return only the key pairs whose names include the string Dave. You can specify multiple values for a filter. A key pair must match at least one of the specified values for it to be included in the results.
You can specify multiple filters (e.g., the key pair name includes the string Dave, and the fingerprint equals a certain value). The result includes information for a particular key pair only if it matches all your filters. If there's no match, no special message is returned; the response is simply empty.
You can use wildcards with the filter values: * matches zero or more characters, and ? matches exactly one character. You can escape special characters using a backslash before the character. For example, a value of \*amazon\?\\ searches for the literal string *amazon?\.
The following table shows the available filters.
| Filter Name | Description |
|---|---|
|
|
Fingerprint of the key pair. Type: String |
|
|
Name of the key pair. Type: String |
| Name | Description | Required |
|---|---|---|
|
|
One or more key pair names. Type: String Default: Describes all key pairs you own, or only those otherwise specified. |
No |
|
|
Name of a filter. See the preceding table for a list of allowed filter names. Type: String Default: None |
No |
|
|
A value for the filter. See the preceding table for a list of allowed values for each filter. Type: String Default: None |
No |
The elements in the following table are wrapped in a
DescribeKeyPairsResponse structure.
| Name | Description |
|---|---|
|
|
The ID of the request. Type: xsd:string |
|
|
List of key pairs. Each key pair's information is wrapped
in an |
This example describes the keypair with name gsg-keypair.
https://ec2.amazonaws.com/?Action=DescribeKeyPairs &KeyName.1=gsg-keypair &AUTHPARAMS
<DescribeKeyPairsResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
<keySet>
<item>
<keyName>gsg-keypair</keyName>
<keyFingerprint>
1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f
</keyFingerprint>
</item>
</keySet>
</DescribeKeyPairsResponse>This example filters the results to display only key pairs whose names include the string Dave.
https://ec2.amazonaws.com/?Action=DescribeKeyPairs &Filter.1.Name=key-name &Filter.1.Value.1=*Dave* &AUTHPARAMS