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
Modifier and TypeClassDescriptionstatic interface
AddOn
is a property of the AWS::Lightsail::Instance resource.static interface
AutoSnapshotAddOn
is a property of the AddOn property.static final class
A fluent builder forCfnInstance
.static interface
Disk
is a property of the Hardware property.static interface
Hardware
is a property of the AWS::Lightsail::Instance resource.static interface
Location
is a property of the AWS::Lightsail::Instance resource.static interface
MonthlyTransfer
is a property of the Networking property.static interface
Networking
is a property of the AWS::Lightsail::Instance resource.static interface
Port
is a property of the Networking property.static interface
State
is a property of the AWS::Lightsail::Instance resource.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionCfnInstance
(Construct scope, String id, CfnInstanceProps props) Create a newAWS::Lightsail::Instance
.protected
CfnInstance
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnInstance
(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,running
orpending
).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.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
An array of add-ons for the instance.void
setAddOns
(IResolvable value) An array of add-ons for the instance.void
setAvailabilityZone
(String value) The Availability Zone for the instance.void
setBlueprintId
(String value) The blueprint ID for the instance (for example,os_amlinux_2016_03
).void
setBundleId
(String value) The bundle ID for the instance (for example,micro_1_0
).void
setHardware
(IResolvable value) The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.void
The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.void
setInstanceName
(String value) The name of the instance.void
setKeyPairName
(String value) The name of the key pair to use for the instance.void
setLocation
(IResolvable value) The location for the instance, such as the AWS Region and Availability Zone.void
The location for the instance, such as the AWS Region and Availability Zone.void
setNetworking
(IResolvable value) The public ports and the monthly amount of data transfer allocated for the instance.void
The public ports and the monthly amount of data transfer allocated for the instance.void
setState
(IResolvable value) The status code and the state (for example,running
) of the instance.void
The status code and the state (for example,running
) of the instance.void
setUserData
(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, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:
inspect
in 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:
renderProperties
in 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,running
orpending
). -
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:
getCfnProperties
in 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
Value
ofTags
is 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
Location
property 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
Location
property 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
Location
property 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
State
property 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
State
property 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
State
property 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 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 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 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 useapt-get
, and FreeBSD usespkg
.
-