Class CfnKeyPair

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, IEnvironmentAware, IKeyPairRef, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.140.0 (build 79fd58c)", date="2026-09-30T11:04:55.323Z") @Stability(Stable) public class CfnKeyPair extends CfnResource implements IInspectable, IKeyPairRef, ITaggableV2
Resource Type definition for AWS::Lightsail::KeyPair.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.lightsail.*;
 CfnKeyPair cfnKeyPair = CfnKeyPair.Builder.create(this, "MyCfnKeyPair")
         .keyPairName("keyPairName")
         // the properties below are optional
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnKeyPair

      protected CfnKeyPair(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnKeyPair

      protected CfnKeyPair(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnKeyPair

      @Stability(Stable) public CfnKeyPair(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnKeyPairProps props)
      Create a new AWS::Lightsail::KeyPair.

      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • arnForKeyPair

      @Stability(Stable) @NotNull public static String arnForKeyPair(@NotNull IKeyPairRef resource)
      Parameters:
      resource - This parameter is required.
    • isCfnKeyPair

      @Stability(Stable) @NotNull public static Boolean isCfnKeyPair(@NotNull Object x)
      Checks whether the given object is a CfnKeyPair.

      Parameters:
      x - This parameter is required.
    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrCreatedAt

      @Stability(Stable) @NotNull public String getAttrCreatedAt()
      The timestamp when the key pair was created.
    • getAttrFingerprint

      @Stability(Stable) @NotNull public String getAttrFingerprint()
      The RSA fingerprint of the key pair.
    • getAttrKeyPairArn

      @Stability(Stable) @NotNull public String getAttrKeyPairArn()
      The Amazon Resource Name (ARN) of the key pair.
    • getAttrLocation

      @Stability(Stable) @NotNull public IResolvable getAttrLocation()
    • getAttrResourceType

      @Stability(Stable) @NotNull public String getAttrResourceType()
      The Lightsail resource type (KeyPair).
    • getAttrSupportCode

      @Stability(Stable) @NotNull public String getAttrSupportCode()
      The support code.

      Include this code in your email to support when you have questions about a key pair in Lightsail.

    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getCfnPropertyNames

      @Stability(Stable) @NotNull protected Map<String,String> getCfnPropertyNames()
      Overrides:
      getCfnPropertyNames in class CfnResource
    • getKeyPairRef

      @Stability(Stable) @NotNull public KeyPairReference getKeyPairRef()
      A reference to a KeyPair resource.
      Specified by:
      getKeyPairRef in interface IKeyPairRef
    • getKeyPairName

      @Stability(Stable) @NotNull public String getKeyPairName()
      The name of the key pair.
    • setKeyPairName

      @Stability(Stable) public void setKeyPairName(@NotNull String value)
      The name of the key pair.
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      The tag keys and optional values to add to the resource during create.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      The tag keys and optional values to add to the resource during create.