Interface KeyPairProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable,ResourceProps
- All Known Implementing Classes:
KeyPairProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:10:03.490Z")
@Stability(Stable)
public interface KeyPairProps
extends software.amazon.jsii.JsiiSerializable, ResourceProps
The properties of a Key Pair.
Example:
Vpc vpc;
InstanceType instanceType;
KeyPair keyPair = KeyPair.Builder.create(this, "KeyPair")
.type(KeyPairType.ED25519)
.format(KeyPairFormat.PEM)
.build();
Instance instance = Instance.Builder.create(this, "Instance")
.vpc(vpc)
.instanceType(instanceType)
.machineImage(MachineImage.latestAmazonLinux2023())
// Use the custom key pair
.keyPair(keyPair)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forKeyPairPropsstatic final classAn implementation forKeyPairProps -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyPairProps.Builderbuilder()default KeyPairFormatThe format of the key pair.default StringA unique name for the key pair.default StringThe public key material.default KeyPairTypegetType()The type of key pair.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJsonMethods inherited from interface software.amazon.awscdk.ResourceProps
getAccount, getEnvironmentFromArn, getPhysicalName, getRegion
-
Method Details
-
getFormat
The format of the key pair.Default: PEM
-
getKeyPairName
A unique name for the key pair.Default: A generated name
-
getPublicKeyMaterial
The public key material.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
-
getType
The type of key pair.Default: RSA (ignored if keyMaterial is provided)
-
builder
- Returns:
- a
KeyPairProps.BuilderofKeyPairProps
-