Show / Hide Table of Contents

Class KeyPair

An EC2 Key Pair.

Inheritance
object
Resource
KeyPair
Implements
IKeyPair
IResource
IConstruct
IDependable
Inherited Members
Resource.IsOwnedResource(IConstruct)
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(string, IArnComponents)
Resource.GetResourceNameAttribute(string)
Resource.Env
Resource.PhysicalName
Resource.Stack
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class KeyPair : Resource, IKeyPair, IResource, IConstruct, IDependable
Syntax (vb)
Public Class KeyPair Inherits Resource Implements IKeyPair, IResource, IConstruct, IDependable
Remarks

Resource: AWS::EC2::KeyPair

ExampleMetadata: infused

Examples
var keyPair = KeyPair.FromKeyPairAttributes(this, "KeyPair", new KeyPairAttributes {
                 KeyPairName = "the-keypair-name",
                 Type = KeyPairType.RSA
             });

Synopsis

Constructors

KeyPair(Construct, string, IKeyPairProps?)

An EC2 Key Pair.

Properties

Format

The format of the key pair.

HasImportedMaterial

Whether the key material was imported.

KeyPairFingerprint

The fingerprint of the key pair.

KeyPairId

The unique ID of the key pair.

KeyPairName

The unique name of the key pair.

PROPERTY_INJECTION_ID

Uniquely identifies this class.

PrivateKey

The Systems Manager Parameter Store parameter with the pair's private key material.

Type

The type of the key pair.

Methods

FromKeyPairAttributes(Construct, string, IKeyPairAttributes)

Imports a key pair with a name and optional type.

FromKeyPairName(Construct, string, string)

Imports a key pair based on the name.

Constructors

KeyPair(Construct, string, IKeyPairProps?)

An EC2 Key Pair.

public KeyPair(Construct scope, string id, IKeyPairProps? props = null)
Parameters
scope Construct
id string
props IKeyPairProps
Remarks

Resource: AWS::EC2::KeyPair

ExampleMetadata: infused

Examples
var keyPair = KeyPair.FromKeyPairAttributes(this, "KeyPair", new KeyPairAttributes {
                 KeyPairName = "the-keypair-name",
                 Type = KeyPairType.RSA
             });

Properties

Format

The format of the key pair.

public virtual KeyPairFormat Format { get; }
Property Value

KeyPairFormat

Remarks

Resource: AWS::EC2::KeyPair

ExampleMetadata: infused

HasImportedMaterial

Whether the key material was imported.

public virtual bool HasImportedMaterial { get; }
Property Value

bool

Remarks

Keys with imported material do not have their private key material stored or returned automatically.

KeyPairFingerprint

The fingerprint of the key pair.

public virtual string KeyPairFingerprint { get; }
Property Value

string

Remarks

Attribute: true

KeyPairId

The unique ID of the key pair.

public virtual string KeyPairId { get; }
Property Value

string

Remarks

Attribute: true

KeyPairName

The unique name of the key pair.

public virtual string KeyPairName { get; }
Property Value

string

Remarks

Attribute: true

PROPERTY_INJECTION_ID

Uniquely identifies this class.

public static string PROPERTY_INJECTION_ID { get; }
Property Value

string

Remarks

Resource: AWS::EC2::KeyPair

ExampleMetadata: infused

PrivateKey

The Systems Manager Parameter Store parameter with the pair's private key material.

public virtual IStringParameter PrivateKey { get; }
Property Value

IStringParameter

Remarks

Resource: AWS::EC2::KeyPair

ExampleMetadata: infused

Type

The type of the key pair.

public virtual KeyPairType? Type { get; }
Property Value

KeyPairType?

Remarks

Resource: AWS::EC2::KeyPair

ExampleMetadata: infused

Methods

FromKeyPairAttributes(Construct, string, IKeyPairAttributes)

Imports a key pair with a name and optional type.

public static IKeyPair FromKeyPairAttributes(Construct scope, string id, IKeyPairAttributes attrs)
Parameters
scope Construct
id string
attrs IKeyPairAttributes
Returns

IKeyPair

Remarks

Resource: AWS::EC2::KeyPair

ExampleMetadata: infused

FromKeyPairName(Construct, string, string)

Imports a key pair based on the name.

public static IKeyPair FromKeyPairName(Construct scope, string id, string keyPairName)
Parameters
scope Construct
id string
keyPairName string
Returns

IKeyPair

Remarks

Resource: AWS::EC2::KeyPair

ExampleMetadata: infused

Implements

IKeyPair
IResource
Constructs.IConstruct
Constructs.IDependable
Back to top Generated by DocFX