Class KeyPair
An EC2 Key Pair.
Inherited Members
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
Remarks
Resource: AWS::EC2::KeyPair
ExampleMetadata: infused
HasImportedMaterial
Whether the key material was imported.
public virtual bool HasImportedMaterial { get; }
Property Value
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
Remarks
Attribute: true
KeyPairId
The unique ID of the key pair.
public virtual string KeyPairId { get; }
Property Value
Remarks
Attribute: true
KeyPairName
The unique name of the key pair.
public virtual string KeyPairName { get; }
Property Value
Remarks
Attribute: true
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
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
Remarks
Resource: AWS::EC2::KeyPair
ExampleMetadata: infused
Type
The type of the key pair.
public virtual KeyPairType? Type { get; }
Property Value
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
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
Returns
Remarks
Resource: AWS::EC2::KeyPair
ExampleMetadata: infused