@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:40.661Z") @Stability(value=Stable) public class CfnInstance extends CfnResource implements IInspectable
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")
.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())
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.userData("userData")
.build();
| Modifier and Type | Class and Description |
|---|---|
static interface |
CfnInstance.AddOnProperty
`AddOn` is a property of the [AWS::Lightsail::Instance](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html) resource.
|
static interface |
CfnInstance.AutoSnapshotAddOnProperty
`AutoSnapshotAddOn` is a property of the [AddOn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-addon.html) property.
|
static class |
CfnInstance.Builder
A fluent builder for
CfnInstance. |
static interface |
CfnInstance.DiskProperty
`Disk` is a property of the [Hardware](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-hardware.html) property.
|
static interface |
CfnInstance.HardwareProperty
`Hardware` is a property of the [AWS::Lightsail::Instance](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html) resource.
|
static interface |
CfnInstance.LocationProperty
`Location` is a property of the [AWS::Lightsail::Instance](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html) resource.
|
static interface |
CfnInstance.MonthlyTransferProperty
`MonthlyTransfer` is a property of the [Networking](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-networking.html) property.
|
static interface |
CfnInstance.NetworkingProperty
`Networking` is a property of the [AWS::Lightsail::Instance](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html) resource.
|
static interface |
CfnInstance.PortProperty
`Port` is a property of the [Networking](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-networking.html) property.
|
static interface |
CfnInstance.StateProperty
`State` is a property of the [AWS::Lightsail::Instance](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html) resource.
|
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnInstance(software.constructs.Construct scope,
String id,
CfnInstanceProps props)
Create a new `AWS::Lightsail::Instance`.
|
protected |
CfnInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnInstance(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
Object |
getAddOns()
An array of add-ons for the instance.
|
Number |
getAttrHardwareCpuCount()
The number of vCPUs the instance has.
|
Number |
getAttrHardwareRamSizeInGb()
The amount of RAM in GB on the instance (for example, `1.0` ).
|
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` ).
|
IResolvable |
getAttrIsStaticIp()
A Boolean value indicating whether the instance has a static IP assigned to it.
|
String |
getAttrLocationAvailabilityZone()
The AWS Region and Availability Zone where the instance is located.
|
String |
getAttrLocationRegionName()
The AWS Region of the instance.
|
String |
getAttrNetworkingMonthlyTransferGbPerMonthAllocated()
The amount of allocated monthly data transfer (in GB) for an instance.
|
String |
getAttrPrivateIpAddress()
The private IP address of the instance.
|
String |
getAttrPublicIpAddress()
The public IP address of the instance.
|
String |
getAttrResourceType()
The resource type of the instance (for example, `Instance` ).
|
String |
getAttrSshKeyName()
The name of the SSH key pair used by the instance.
|
Number |
getAttrStateCode()
The status code of the instance.
|
String |
getAttrStateName()
The state of the instance (for example, `running` or `pending` ).
|
String |
getAttrSupportCode()
The support code of the instance.
|
String |
getAttrUserName()
The user name for connecting to the instance (for example, `ec2-user` ).
|
String |
getAvailabilityZone()
The Availability Zone for the instance.
|
String |
getBlueprintId()
The blueprint ID for the instance (for example, `os_amlinux_2016_03` ).
|
String |
getBundleId()
The bundle ID for the instance (for example, `micro_1_0` ).
|
protected Map<String,Object> |
getCfnProperties() |
Object |
getHardware()
The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.
|
String |
getInstanceName()
The name of the instance.
|
String |
getKeyPairName()
The name of the key pair to use for the instance.
|
Object |
getNetworking()
The public ports and the monthly amount of data transfer allocated for the instance.
|
TagManager |
getTags()
An array of key-value pairs to apply to this resource.
|
String |
getUserData()
The optional launch script for the instance.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setAddOns(IResolvable value)
An array of add-ons for the instance.
|
void |
setAddOns(List<Object> 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(CfnInstance.HardwareProperty value)
The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.
|
void |
setHardware(IResolvable value)
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 |
setNetworking(CfnInstance.NetworkingProperty value)
The public ports and the monthly amount of data transfer allocated for the instance.
|
void |
setNetworking(IResolvable value)
The public ports and the monthly amount of data transfer allocated for the instance.
|
void |
setUserData(String value)
The optional launch script for the instance.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnInstance(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnInstance(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
CfnInstanceProps props)
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.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public Number getAttrHardwareCpuCount()
@Stability(value=Stable) @NotNull public Number getAttrHardwareRamSizeInGb()
@Stability(value=Stable) @NotNull public String getAttrInstanceArn()
@Stability(value=Stable) @NotNull public IResolvable getAttrIsStaticIp()
@Stability(value=Stable) @NotNull public String getAttrLocationAvailabilityZone()
@Stability(value=Stable) @NotNull public String getAttrLocationRegionName()
@Stability(value=Stable) @NotNull public String getAttrNetworkingMonthlyTransferGbPerMonthAllocated()
@Stability(value=Stable) @NotNull public String getAttrPrivateIpAddress()
@Stability(value=Stable) @NotNull public String getAttrPublicIpAddress()
@Stability(value=Stable) @NotNull public String getAttrResourceType()
@Stability(value=Stable) @NotNull public String getAttrSshKeyName()
@Stability(value=Stable) @NotNull public Number getAttrStateCode()
@Stability(value=Stable) @NotNull public String getAttrStateName()
@Stability(value=Stable) @NotNull public String getAttrSupportCode()
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.
@Stability(value=Stable) @NotNull public String getAttrUserName()
@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public TagManager getTags()
For more information, see Tag in the AWS CloudFormation User Guide .
The
ValueofTagsis optional for Lightsail resources.
@Stability(value=Stable) @NotNull public String getBlueprintId()
@Stability(value=Stable)
public void setBlueprintId(@NotNull
String value)
@Stability(value=Stable) @NotNull public String getBundleId()
@Stability(value=Stable)
public void setBundleId(@NotNull
String value)
@Stability(value=Stable) @NotNull public String getInstanceName()
@Stability(value=Stable)
public void setInstanceName(@NotNull
String value)
@Stability(value=Stable) @Nullable public Object getAddOns()
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.
@Stability(value=Stable)
public void setAddOns(@Nullable
IResolvable value)
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.
@Stability(value=Stable)
public void setAddOns(@Nullable
List<Object> value)
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.
@Stability(value=Stable) @Nullable public String getAvailabilityZone()
@Stability(value=Stable)
public void setAvailabilityZone(@Nullable
String value)
@Stability(value=Stable) @Nullable public Object getHardware()
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.
@Stability(value=Stable)
public void setHardware(@Nullable
CfnInstance.HardwareProperty value)
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.
@Stability(value=Stable)
public void setHardware(@Nullable
IResolvable value)
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.
@Stability(value=Stable) @Nullable public String getKeyPairName()
If no key pair name is specified, the Regional Lightsail default key pair is used.
@Stability(value=Stable)
public void setKeyPairName(@Nullable
String value)
If no key pair name is specified, the Regional Lightsail default key pair is used.
@Stability(value=Stable) @Nullable public Object getNetworking()
@Stability(value=Stable)
public void setNetworking(@Nullable
CfnInstance.NetworkingProperty value)
@Stability(value=Stable)
public void setNetworking(@Nullable
IResolvable value)
@Stability(value=Stable) @Nullable public String getUserData()
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.
@Stability(value=Stable)
public void setUserData(@Nullable
String value)
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.
Copyright © 2022. All rights reserved.