Class CfnInstance
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.lightsail.CfnInstance
- All Implemented Interfaces:
IInspectable,IEnvironmentAware,IInstanceRef,ITaggable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T22:26:39.742Z")
@Stability(Stable)
public class CfnInstance
extends CfnResource
implements IInspectable, IInstanceRef, 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAddOnis a property of the AWS::Lightsail::Instance resource.static interfaceAutoSnapshotAddOnis a property of the AddOn property.static final classA fluent builder forCfnInstance.static interfaceDiskis a property of the Hardware property.static interfaceHardwareis a property of the AWS::Lightsail::Instance resource.static interfaceLocationis a property of the AWS::Lightsail::Instance resource.static interfaceMonthlyTransferis a property of the Networking property.static interfaceNetworkingis a property of the AWS::Lightsail::Instance resource.static interfacePortis a property of the Networking property.static interfaceStateis a property of the AWS::Lightsail::Instance resource.Nested 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.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.lightsail.IInstanceRef
IInstanceRef.Jsii$Default, IInstanceRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnInstance(software.amazon.jsii.JsiiObjectRef objRef) CfnInstance(software.constructs.Construct scope, String id, CfnInstanceProps props) Create a newAWS::Lightsail::Instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringarnForInstance(IInstanceRef resource) An array of add-ons for the instance.The number of vCPUs the instance has.The amount of RAM in GB on the instance (for example,1.0).The Amazon Resource Name (ARN) of the instance (for example,arn:aws:lightsail:us-east-2:123456789101:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE).The IPv6 addresses of the instance.A Boolean value indicating whether the instance has a static IP assigned to it.The AWS Region and Availability Zone where the instance is located.The AWS Region of the instance.The amount of allocated monthly data transfer (in GB) for an instance.The private IP address of the instance.The public IP address of the instance.The resource type of the instance (for example,Instance).The name of the SSH key pair used by the instance.The status code of the instance.The state of the instance (for example,runningorpending).The support code of the instance.The user name for connecting to the instance (for example,ec2-user).The Availability Zone for the instance.The blueprint ID for the instance (for example,os_amlinux_2016_03).The bundle ID for the instance (for example,micro_1_0).The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.The name of the instance.A reference to a Instance resource.The name of the key pair to use for the instance.The location for the instance, such as the AWS Region and Availability Zone.The public ports and the monthly amount of data transfer allocated for the instance.getState()The status code and the state (for example,running) of the instance.getTags()Tag Manager which manages the tags for this resource.An array of key-value pairs to apply to this resource.The optional launch script for the instance.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.static BooleanChecks whether the given object is a CfnInstance.renderProperties(Map<String, Object> props) voidAn array of add-ons for the instance.voidsetAddOns(IResolvable value) An array of add-ons for the instance.voidsetAvailabilityZone(String value) The Availability Zone for the instance.voidsetBlueprintId(String value) The blueprint ID for the instance (for example,os_amlinux_2016_03).voidsetBundleId(String value) The bundle ID for the instance (for example,micro_1_0).voidsetHardware(IResolvable value) The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.voidThe hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.voidsetInstanceName(String value) The name of the instance.voidsetKeyPairName(String value) The name of the key pair to use for the instance.voidsetLocation(IResolvable value) The location for the instance, such as the AWS Region and Availability Zone.voidThe location for the instance, such as the AWS Region and Availability Zone.voidsetNetworking(IResolvable value) The public ports and the monthly amount of data transfer allocated for the instance.voidThe public ports and the monthly amount of data transfer allocated for the instance.voidsetState(IResolvable value) The status code and the state (for example,running) of the instance.voidThe status code and the state (for example,running) of the instance.voidsetTagsRaw(List<CfnTag> value) An array of key-value pairs to apply to this resource.voidsetUserData(String value) The optional launch script for the instance.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods 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.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
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) Create a newAWS::Lightsail::Instance.- 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
-
arnForInstance
- Parameters:
resource- This parameter is required.
-
isCfnInstance
Checks whether the given object is a CfnInstance.- Parameters:
x- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- 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:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrHardwareCpuCount
The number of vCPUs the instance has. -
getAttrHardwareRamSizeInGb
The amount of RAM in GB on the instance (for example,1.0). -
getAttrInstanceArn
The Amazon Resource Name (ARN) of the instance (for example,arn:aws:lightsail:us-east-2:123456789101:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE). -
getAttrIpv6Addresses
The IPv6 addresses of the instance. -
getAttrIsStaticIp
A Boolean value indicating whether the instance has a static IP assigned to it. -
getAttrLocationAvailabilityZone
The AWS Region and Availability Zone where the instance is located. -
getAttrLocationRegionName
The AWS Region of the instance. -
getAttrNetworkingMonthlyTransferGbPerMonthAllocated
The amount of allocated monthly data transfer (in GB) for an instance. -
getAttrPrivateIpAddress
The private IP address of the instance. -
getAttrPublicIpAddress
The public IP address of the instance. -
getAttrResourceType
The resource type of the instance (for example,Instance). -
getAttrSshKeyName
The name of the SSH key pair used by the instance. -
getAttrStateCode
The status code of the instance. -
getAttrStateName
The state of the instance (for example,runningorpending). -
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
The user name for connecting to the instance (for example,ec2-user). -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getInstanceRef
A reference to a Instance resource.- Specified by:
getInstanceRefin interfaceIInstanceRef
-
getTags
Tag Manager which manages the tags for this resource. -
getBlueprintId
The blueprint ID for the instance (for example,os_amlinux_2016_03). -
setBlueprintId
The blueprint ID for the instance (for example,os_amlinux_2016_03). -
getBundleId
The bundle ID for the instance (for example,micro_1_0). -
setBundleId
The bundle ID for the instance (for example,micro_1_0). -
getInstanceName
The name of the instance. -
setInstanceName
The name of the instance. -
getAddOns
An array of add-ons for the instance.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnInstance.AddOnProperty> -
setAddOns
An array of add-ons for the instance. -
setAddOns
An array of add-ons for the instance. -
getAvailabilityZone
The Availability Zone for the instance. -
setAvailabilityZone
The Availability Zone for the instance. -
getHardware
The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.Returns union: either
IResolvableorCfnInstance.HardwareProperty -
setHardware
The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM. -
setHardware
The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM. -
getKeyPairName
The name of the key pair to use for the instance. -
setKeyPairName
The name of the key pair to use for the instance. -
getLocation
The location for the instance, such as the AWS Region and Availability Zone.Returns union: either
IResolvableorCfnInstance.LocationProperty -
setLocation
The location for the instance, such as the AWS Region and Availability Zone. -
setLocation
The location for the instance, such as the AWS Region and Availability Zone. -
getNetworking
The public ports and the monthly amount of data transfer allocated for the instance.Returns union: either
IResolvableorCfnInstance.NetworkingProperty -
setNetworking
The public ports and the monthly amount of data transfer allocated for the instance. -
setNetworking
The public ports and the monthly amount of data transfer allocated for the instance. -
getState
The status code and the state (for example,running) of the instance.Returns union: either
IResolvableorCfnInstance.StateProperty -
setState
The status code and the state (for example,running) of the instance. -
setState
The status code and the state (for example,running) of the instance. -
getTagsRaw
An array of key-value pairs to apply to this resource. -
setTagsRaw
An array of key-value pairs to apply to this resource. -
getUserData
The optional launch script for the instance. -
setUserData
The optional launch script for the instance.
-