Class CfnInstance

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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:29:59.757Z") @Stability(Stable) public class CfnInstance extends CfnResource implements IInspectable
A CloudFormation AWS::Lightsail::Instance.

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(123)
                 .build())
         .state(StateProperty.builder()
                 .code(123)
                 .name("name")
                 .build())
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .userData("userData")
         .build();
 
  • 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 Construct scope, @NotNull String id, @NotNull CfnInstanceProps props)
      Create a new AWS::Lightsail::Instance.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      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()
      An array of key-value pairs to apply to this resource.

      For more information, see Tag in the AWS CloudFormation User Guide .

      The Value of Tags is optional for Lightsail resources.

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

      If the instance has an add-on enabled when performing a delete instance request, the add-on is automatically disabled before the instance is deleted.

    • setAddOns

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

      If the instance has an add-on enabled when performing a delete instance request, the add-on is automatically disabled before the instance is deleted.

    • setAddOns

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

      If the instance has an add-on enabled when performing a delete instance request, the add-on is automatically disabled before the instance is deleted.

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

      The instance restarts when performing an attach disk or detach disk request. This resets the public IP address of your instance if a static IP isn't attached to it.

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

      The instance restarts when performing an attach disk or detach disk request. This resets the public IP address of your instance if a static IP isn't attached to it.

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

      The instance restarts when performing an attach disk or detach disk request. This resets the public IP address of your instance if a static IP isn't attached to it.

    • getKeyPairName

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

      If no key pair name is specified, the Regional Lightsail default key pair is used.

    • setKeyPairName

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

      If no key pair name is specified, the Regional Lightsail default key pair is used.

    • getLocation

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

      The Location property is read-only and should not be specified in a create instance or update instance request.

    • setLocation

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

      The Location property is read-only and should not be specified in a create instance or update instance request.

    • setLocation

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

      The Location property is read-only and should not be specified in a create instance or update instance request.

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

      The State property is read-only and should not be specified in a create instance or update instance request.

    • setState

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

      The State property is read-only and should not be specified in a create instance or update instance request.

    • setState

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

      The State property is read-only and should not be specified in a create instance or update instance request.

    • getUserData

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

      Specify a launch script to configure an instance with additional user data. For example, you might want to specify apt-get -y update as a launch script.

      Depending on the blueprint of your instance, the command to get software on your instance varies. Amazon Linux and CentOS use yum , Debian and Ubuntu use apt-get , and FreeBSD uses pkg .

    • setUserData

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

      Specify a launch script to configure an instance with additional user data. For example, you might want to specify apt-get -y update as a launch script.

      Depending on the blueprint of your instance, the command to get software on your instance varies. Amazon Linux and CentOS use yum , Debian and Ubuntu use apt-get , and FreeBSD uses pkg .