Interface IKeyPairProps
The properties of a Key Pair.
Inherited Members
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IKeyPairProps : IResourceProps
Syntax (vb)
Public Interface IKeyPairProps
Inherits IResourceProps
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
InstanceType instanceType;
var keyPair = new KeyPair(this, "KeyPair", new KeyPairProps {
Type = KeyPairType.ED25519,
Format = KeyPairFormat.PEM
});
var instance = new Instance(this, "Instance", new InstanceProps {
Vpc = vpc,
InstanceType = instanceType,
MachineImage = MachineImage.LatestAmazonLinux2023(),
// Use the custom key pair
KeyPair = keyPair
});
Synopsis
Properties
Format | The format of the key pair. |
KeyPairName | A unique name for the key pair. |
PublicKeyMaterial | The public key material. |
Type | The type of key pair. |
Properties
Format
The format of the key pair.
virtual Nullable<KeyPairFormat> Format { get; }
Property Value
System.Nullable<KeyPairFormat>
Remarks
Default: PEM
KeyPairName
A unique name for the key pair.
virtual string KeyPairName { get; }
Property Value
System.String
Remarks
Default: A generated name
PublicKeyMaterial
The public key material.
virtual string PublicKeyMaterial { get; }
Property Value
System.String
Remarks
If this is provided the key is considered "imported". For imported keys, it is assumed that you already have the private key material so the private key material will not be returned or stored in AWS Systems Manager Parameter Store.
Default: a public and private key will be generated
Type
The type of key pair.
virtual Nullable<KeyPairType> Type { get; }
Property Value
System.Nullable<KeyPairType>
Remarks
Default: RSA (ignored if keyMaterial is provided)