Class CfnInstance

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

@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-04-10T22:22:30.282Z") @Stability(Stable) public class CfnInstance extends CfnResource implements IInspectable, ITaggable
The AWS::Lightsail::Instance resource specifies an Amazon Lightsail instance.

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.*;
 CfnInstance cfnInstance = CfnInstance.Builder.create(this, "MyCfnInstance")
         .blueprintId("blueprintId")
         .bundleId("bundleId")
         .instanceName("instanceName")
         // the properties below are optional
         .addOns(List.of(AddOnProperty.builder()
                 .addOnType("addOnType")
                 // the properties below are optional
                 .autoSnapshotAddOnRequest(AutoSnapshotAddOnProperty.builder()
                         .snapshotTimeOfDay("snapshotTimeOfDay")
                         .build())
                 .status("status")
                 .build()))
         .availabilityZone("availabilityZone")
         .hardware(HardwareProperty.builder()
                 .cpuCount(123)
                 .disks(List.of(DiskProperty.builder()
                         .diskName("diskName")
                         .path("path")
                         // the properties below are optional
                         .attachedTo("attachedTo")
                         .attachmentState("attachmentState")
                         .iops(123)
                         .isSystemDisk(false)
                         .sizeInGb("sizeInGb")
                         .build()))
                 .ramSizeInGb(123)
                 .build())
         .keyPairName("keyPairName")
         .location(LocationProperty.builder()
                 .availabilityZone("availabilityZone")
                 .regionName("regionName")
                 .build())
         .networking(NetworkingProperty.builder()
                 .ports(List.of(PortProperty.builder()
                         .accessDirection("accessDirection")
                         .accessFrom("accessFrom")
                         .accessType("accessType")
                         .cidrListAliases(List.of("cidrListAliases"))
                         .cidrs(List.of("cidrs"))
                         .commonName("commonName")
                         .fromPort(123)
                         .ipv6Cidrs(List.of("ipv6Cidrs"))
                         .protocol("protocol")
                         .toPort(123)
                         .build()))
                 // the properties below are optional
                 .monthlyTransfer(MonthlyTransferProperty.builder()
                         .gbPerMonthAllocated("gbPerMonthAllocated")
                         .build())
                 .build())
         .state(StateProperty.builder()
                 .code(123)
                 .name("name")
                 .build())
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .userData("userData")
         .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

    • CfnInstance

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

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

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

    • 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.
    • getAttrHardwareCpuCount

      @Stability(Stable) @NotNull public Number getAttrHardwareCpuCount()
      The number of vCPUs the instance has.
    • getAttrHardwareRamSizeInGb

      @Stability(Stable) @NotNull public Number getAttrHardwareRamSizeInGb()
      The amount of RAM in GB on the instance (for example, 1.0 ).
    • getAttrInstanceArn

      @Stability(Stable) @NotNull public String getAttrInstanceArn()
      The Amazon Resource Name (ARN) of the instance (for example, arn:aws:lightsail:us-east-2:123456789101:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE ).
    • getAttrIsStaticIp

      @Stability(Stable) @NotNull public IResolvable getAttrIsStaticIp()
      A Boolean value indicating whether the instance has a static IP assigned to it.
    • getAttrLocationAvailabilityZone

      @Stability(Stable) @NotNull public String getAttrLocationAvailabilityZone()
      The AWS Region and Availability Zone where the instance is located.
    • getAttrLocationRegionName

      @Stability(Stable) @NotNull public String getAttrLocationRegionName()
      The AWS Region of the instance.
    • getAttrNetworkingMonthlyTransferGbPerMonthAllocated

      @Stability(Stable) @NotNull public String getAttrNetworkingMonthlyTransferGbPerMonthAllocated()
      The amount of allocated monthly data transfer (in GB) for an instance.
    • getAttrPrivateIpAddress

      @Stability(Stable) @NotNull public String getAttrPrivateIpAddress()
      The private IP address of the instance.
    • getAttrPublicIpAddress

      @Stability(Stable) @NotNull public String getAttrPublicIpAddress()
      The public IP address of the instance.
    • getAttrResourceType

      @Stability(Stable) @NotNull public String getAttrResourceType()
      The resource type of the instance (for example, Instance ).
    • getAttrSshKeyName

      @Stability(Stable) @NotNull public String getAttrSshKeyName()
      The name of the SSH key pair used by the instance.
    • getAttrStateCode

      @Stability(Stable) @NotNull public Number getAttrStateCode()
      The status code of the instance.
    • getAttrStateName

      @Stability(Stable) @NotNull public String getAttrStateName()
      The state of the instance (for example, running or pending ).
    • getAttrSupportCode

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

      Include this code in your email to support when you have questions about an instance or another resource in Lightsail . This code helps our support team to look up your Lightsail information.

    • getAttrUserName

      @Stability(Stable) @NotNull public String getAttrUserName()
      The user name for connecting to the instance (for example, ec2-user ).
    • getCfnProperties

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

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

      @Stability(Stable) @NotNull public String getBlueprintId()
      The blueprint ID for the instance (for example, os_amlinux_2016_03 ).
    • setBlueprintId

      @Stability(Stable) public void setBlueprintId(@NotNull String value)
      The blueprint ID for the instance (for example, os_amlinux_2016_03 ).
    • getBundleId

      @Stability(Stable) @NotNull public String getBundleId()
      The bundle ID for the instance (for example, micro_1_0 ).
    • setBundleId

      @Stability(Stable) public void setBundleId(@NotNull String value)
      The bundle ID for the instance (for example, micro_1_0 ).
    • getInstanceName

      @Stability(Stable) @NotNull public String getInstanceName()
      The name of the instance.
    • setInstanceName

      @Stability(Stable) public void setInstanceName(@NotNull String value)
      The name of the instance.
    • getAddOns

      @Stability(Stable) @Nullable public Object getAddOns()
      An array of add-ons for the instance.
    • setAddOns

      @Stability(Stable) public void setAddOns(@Nullable IResolvable value)
      An array of add-ons for the instance.
    • setAddOns

      @Stability(Stable) public void setAddOns(@Nullable List<Object> value)
      An array of add-ons for the instance.
    • getAvailabilityZone

      @Stability(Stable) @Nullable public String getAvailabilityZone()
      The Availability Zone for the instance.
    • setAvailabilityZone

      @Stability(Stable) public void setAvailabilityZone(@Nullable String value)
      The Availability Zone for the instance.
    • getHardware

      @Stability(Stable) @Nullable public Object getHardware()
      The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.
    • setHardware

      @Stability(Stable) public void setHardware(@Nullable IResolvable value)
      The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.
    • setHardware

      @Stability(Stable) public void setHardware(@Nullable CfnInstance.HardwareProperty value)
      The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.
    • getKeyPairName

      @Stability(Stable) @Nullable public String getKeyPairName()
      The name of the key pair to use for the instance.
    • setKeyPairName

      @Stability(Stable) public void setKeyPairName(@Nullable String value)
      The name of the key pair to use for the instance.
    • getLocation

      @Stability(Stable) @Nullable public Object getLocation()
      The location for the instance, such as the AWS Region and Availability Zone.
    • setLocation

      @Stability(Stable) public void setLocation(@Nullable IResolvable value)
      The location for the instance, such as the AWS Region and Availability Zone.
    • setLocation

      @Stability(Stable) public void setLocation(@Nullable CfnInstance.LocationProperty value)
      The location for the instance, such as the AWS Region and Availability Zone.
    • getNetworking

      @Stability(Stable) @Nullable public Object getNetworking()
      The public ports and the monthly amount of data transfer allocated for the instance.
    • setNetworking

      @Stability(Stable) public void setNetworking(@Nullable IResolvable value)
      The public ports and the monthly amount of data transfer allocated for the instance.
    • setNetworking

      @Stability(Stable) public void setNetworking(@Nullable CfnInstance.NetworkingProperty value)
      The public ports and the monthly amount of data transfer allocated for the instance.
    • getState

      @Stability(Stable) @Nullable public Object getState()
      The status code and the state (for example, running ) of the instance.
    • setState

      @Stability(Stable) public void setState(@Nullable IResolvable value)
      The status code and the state (for example, running ) of the instance.
    • setState

      @Stability(Stable) public void setState(@Nullable CfnInstance.StateProperty value)
      The status code and the state (for example, running ) of the instance.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      An array of key-value pairs to apply to this resource.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      An array of key-value pairs to apply to this resource.
    • getUserData

      @Stability(Stable) @Nullable public String getUserData()
      The optional launch script for the instance.
    • setUserData

      @Stability(Stable) public void setUserData(@Nullable String value)
      The optional launch script for the instance.