Class CfnInstance
- All Implemented Interfaces:
IConstruct,IDependable,IInspectable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
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();
-
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.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCfnInstance(Construct scope, String id, CfnInstanceProps props) Create a newAWS::Lightsail::Instance.protectedCfnInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnInstance(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionAn 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).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.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()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.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.voidsetUserData(String value) The optional launch script for the instance.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.core.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods 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.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 Construct scope, @NotNull String id, @NotNull CfnInstanceProps props) Create a newAWS::Lightsail::Instance.- Parameters:
scope-- scope in which this resource is defined.
id-- scoped id of the resource.
props-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector-- tree inspector to collect and process attributes.
-
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). -
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
-
getTags
An array of key-value pairs to apply to this resource.For more information, see Tag in the AWS CloudFormation User Guide .
The
ValueofTagsis optional for Lightsail resources. -
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.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
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
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
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.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
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
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
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
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
The location for the instance, such as the AWS Region and Availability Zone.The
Locationproperty is read-only and should not be specified in a create instance or update instance request. -
setLocation
The location for the instance, such as the AWS Region and Availability Zone.The
Locationproperty is read-only and should not be specified in a create instance or update instance request. -
setLocation
The location for the instance, such as the AWS Region and Availability Zone.The
Locationproperty is read-only and should not be specified in a create instance or update instance request. -
getNetworking
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. -
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.The
Stateproperty is read-only and should not be specified in a create instance or update instance request. -
setState
The status code and the state (for example,running) of the instance.The
Stateproperty is read-only and should not be specified in a create instance or update instance request. -
setState
The status code and the state (for example,running) of the instance.The
Stateproperty is read-only and should not be specified in a create instance or update instance request. -
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 updateas 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 useapt-get, and FreeBSD usespkg. -
setUserData
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 updateas 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 useapt-get, and FreeBSD usespkg.
-