AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the DescribeKeyPairs operation. Describes the specified key pairs or all of your key pairs.

For more information about key pairs, see Amazon EC2 key pairs in the Amazon Elastic Compute Cloud User Guide.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.EC2.AmazonEC2Request
      Amazon.EC2.Model.DescribeKeyPairsRequest

Namespace: Amazon.EC2.Model
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public class DescribeKeyPairsRequest : AmazonEC2Request
         IAmazonWebServiceRequest

The DescribeKeyPairsRequest type exposes the following members

Constructors

NameDescription
Public Method DescribeKeyPairsRequest()

Properties

NameTypeDescription
Public Property Filters System.Collections.Generic.List<Amazon.EC2.Model.Filter>

Gets and sets the property Filters.

The filters.

  • key-pair-id - The ID of the key pair.

  • fingerprint - The fingerprint of the key pair.

  • key-name - The name of the key pair.

  • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

  • tag: - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

Public Property IncludePublicKey System.Boolean

Gets and sets the property IncludePublicKey.

If true, the public key material is included in the response.

Default: false

Public Property KeyNames System.Collections.Generic.List<System.String>

Gets and sets the property KeyNames.

The key pair names.

Default: Describes all of your key pairs.

Public Property KeyPairIds System.Collections.Generic.List<System.String>

Gets and sets the property KeyPairIds.

The IDs of the key pairs.

Examples

This example displays the fingerprint for the specified key.

To display a key pair


var client = new AmazonEC2Client();
var response = client.DescribeKeyPairs(new DescribeKeyPairsRequest 
{
    KeyNames = new List<string> {
        "my-key-pair"
    }
});

List<KeyPairInfo> keyPairs = response.KeyPairs;

            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5