Class KeyPair
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.KeyPair
- All Implemented Interfaces:
IResource,IKeyPair,IKeyPairRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:38.095Z")
@Stability(Stable)
public class KeyPair
extends Resource
implements IKeyPair
An EC2 Key Pair.
Example:
IKeyPair keyPair = KeyPair.fromKeyPairAttributes(this, "KeyPair", KeyPairAttributes.builder()
.keyPairName("the-keypair-name")
.type(KeyPairType.RSA)
.build());
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IKeyPair
IKeyPair.Jsii$Default, IKeyPair.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedKeyPair(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedKeyPair(software.amazon.jsii.JsiiObjectRef objRef) KeyPair(software.constructs.Construct scope, String id, KeyPairProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IKeyPairfromKeyPairAttributes(software.constructs.Construct scope, String id, KeyPairAttributes attrs) Imports a key pair with a name and optional type.static IKeyPairfromKeyPairName(software.constructs.Construct scope, String id, String keyPairName) Imports a key pair based on the name.The format of the key pair.Whether the key material was imported.The fingerprint of the key pair.The unique ID of the key pair.The unique name of the key pair.A reference to a KeyPair resource.The Systems Manager Parameter Store parameter with the pair's private key material.getType()The type of the key pair.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
KeyPair
protected KeyPair(software.amazon.jsii.JsiiObjectRef objRef) -
KeyPair
protected KeyPair(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
KeyPair
@Stability(Stable) public KeyPair(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable KeyPairProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props-
-
KeyPair
- Parameters:
scope- This parameter is required.id- This parameter is required.
-
-
Method Details
-
fromKeyPairAttributes
@Stability(Stable) @NotNull public static IKeyPair fromKeyPairAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull KeyPairAttributes attrs) Imports a key pair with a name and optional type.- Parameters:
scope- This parameter is required.id- This parameter is required.attrs- This parameter is required.
-
fromKeyPairName
@Stability(Stable) @NotNull public static IKeyPair fromKeyPairName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String keyPairName) Imports a key pair based on the name.- Parameters:
scope- This parameter is required.id- This parameter is required.keyPairName- This parameter is required.
-
getFormat
The format of the key pair. -
getHasImportedMaterial
Whether the key material was imported.Keys with imported material do not have their private key material stored or returned automatically.
-
getKeyPairFingerprint
The fingerprint of the key pair. -
getKeyPairId
The unique ID of the key pair. -
getKeyPairName
The unique name of the key pair.- Specified by:
getKeyPairNamein interfaceIKeyPair
-
getKeyPairRef
A reference to a KeyPair resource.- Specified by:
getKeyPairRefin interfaceIKeyPairRef
-
getPrivateKey
The Systems Manager Parameter Store parameter with the pair's private key material. -
getType
The type of the key pair.
-