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, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-02T15:58:24.806Z") @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());
 
  • 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

      @Stability(Stable) public KeyPair(@NotNull software.constructs.Construct scope, @NotNull String id)
      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

      @Stability(Stable) @NotNull public KeyPairFormat getFormat()
      The format of the key pair.
    • getHasImportedMaterial

      @Stability(Stable) @NotNull public Boolean getHasImportedMaterial()
      Whether the key material was imported.

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

    • getKeyPairFingerprint

      @Stability(Stable) @NotNull public String getKeyPairFingerprint()
      The fingerprint of the key pair.
    • getKeyPairId

      @Stability(Stable) @NotNull public String getKeyPairId()
      The unique ID of the key pair.
    • getKeyPairName

      @Stability(Stable) @NotNull public String getKeyPairName()
      The unique name of the key pair.
      Specified by:
      getKeyPairName in interface IKeyPair
    • getPrivateKey

      @Stability(Stable) @NotNull public IStringParameter getPrivateKey()
      The Systems Manager Parameter Store parameter with the pair's private key material.
    • getType

      @Stability(Stable) @Nullable public KeyPairType getType()
      The type of the key pair.
      Specified by:
      getType in interface IKeyPair