Amazon Elastic Compute Cloud
API Reference (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

DescribeKeyPairs

Description

Describes one or more of your key pairs.

Request Parameters

KeyName.n

One or more key pair names.

Type: String

Default: Describes all key pairs you own, or only those otherwise specified.

Required: No

Filter.n.Name

The name of a filter. See the Supported Filters section for a list of supported filter names.

Type: String

Default: None

Required: No

Filter.n.Value.m

A value for the filter. See the Supported Filters section for a list of supported values for each filter.

Type: String

Default: None

Required: No

Supported Filters

You can specify filters so that the response includes information for only certain key pairs. For example, you can use a filter to specify that you're interested in key pairs whose names include the string Dave. You can specify multiple values for a filter. The response includes information for a key pair only if it matches at least one of the filter values that you specified.

You can specify multiple filters; for example, specify key pairs whose names include the string Dave and whose fingerprint is a specific value. The response includes information for a key pair only if it matches all the filters that you specified. If there's no match, no special message is returned, the response is simply empty.

You can use wildcards in a filter value. An asterisk (*) matches zero or more characters, and a question mark (?) 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 are the available filters.

fingerprint

The fingerprint of the key pair.

Type: String

key-name

The name of the key pair.

Type: String

Response Elements

The following elements are returned in a DescribeKeyPairsResponse element.

requestId

The ID of the request.

Type: xsd:string

keySet

A list of key pairs, each one wrapped in an item element.

Type: DescribeKeyPairsResponseItemType

Examples

Example Request

This example describes the keypair with name gsg-keypair.

https://ec2.amazonaws.com/?Action=DescribeKeyPairs
&KeyName.1=gsg-keypair
&AUTHPARAMS

Example Response

<DescribeKeyPairsResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
    <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
    <keySet>
      <item>
         <keyName>gsg-keypair</keyName>
         <keyFingerprint>
         00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
         </keyFingerprint>
      </item>
   </keySet>
</DescribeKeyPairsResponse>

Example Request

This example filters the response to include 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