@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-14T16:25:24.018Z") 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") .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();
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.
|
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnInstance(Construct scope,
java.lang.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 |
---|---|
java.lang.Object |
getAddOns()
An array of add-ons for the instance.
|
java.lang.Number |
getAttrHardwareCpuCount()
The number of vCPUs the instance has.
|
java.lang.Number |
getAttrHardwareRamSizeInGb()
The amount of RAM in GB on the instance (for example, `1.0` ).
|
java.lang.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.
|
java.lang.String |
getAttrLocationAvailabilityZone()
The AWS Region and Availability Zone where the instance is located.
|
java.lang.String |
getAttrLocationRegionName()
The AWS Region of the instance.
|
java.lang.String |
getAttrNetworkingMonthlyTransferGbPerMonthAllocated()
The amount of allocated monthly data transfer (in GB) for an instance.
|
java.lang.String |
getAttrPrivateIpAddress()
The private IP address of the instance.
|
java.lang.String |
getAttrPublicIpAddress()
The public IP address of the instance.
|
java.lang.String |
getAttrResourceType()
The resource type of the instance (for example, `Instance` ).
|
java.lang.String |
getAttrSshKeyName()
The name of the SSH key pair used by the instance.
|
java.lang.Number |
getAttrStateCode()
The status code of the instance.
|
java.lang.String |
getAttrStateName()
The state of the instance (for example, `running` or `pending` ).
|
java.lang.String |
getAttrSupportCode()
The support code of the instance.
|
java.lang.String |
getAttrUserName()
The user name for connecting to the instance (for example, `ec2-user` ).
|
java.lang.String |
getAvailabilityZone()
The Availability Zone for the instance.
|
java.lang.String |
getBlueprintId()
The blueprint ID for the instance (for example, `os_amlinux_2016_03` ).
|
java.lang.String |
getBundleId()
The bundle ID for the instance (for example, `micro_1_0` ).
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.Object |
getHardware()
The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.
|
java.lang.String |
getInstanceName()
The name of the instance.
|
java.lang.String |
getKeyPairName()
The name of the key pair to use for the instance.
|
java.lang.Object |
getLocation()
The location for the instance, such as the AWS Region and Availability Zone.
|
java.lang.Object |
getNetworking()
The public ports and the monthly amount of data transfer allocated for the instance.
|
java.lang.Object |
getState()
The status code and the state (for example, `running` ) of the instance.
|
TagManager |
getTags()
An array of key-value pairs to apply to this resource.
|
java.lang.String |
getUserData()
The optional launch script for the instance.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setAddOns(IResolvable value)
An array of add-ons for the instance.
|
void |
setAddOns(java.util.List<java.lang.Object> value)
An array of add-ons for the instance.
|
void |
setAvailabilityZone(java.lang.String value)
The Availability Zone for the instance.
|
void |
setBlueprintId(java.lang.String value)
The blueprint ID for the instance (for example, `os_amlinux_2016_03` ).
|
void |
setBundleId(java.lang.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(java.lang.String value)
The name of the instance.
|
void |
setKeyPairName(java.lang.String value)
The name of the key pair to use for the instance.
|
void |
setLocation(CfnInstance.LocationProperty value)
The location for the instance, such as the AWS Region and Availability Zone.
|
void |
setLocation(IResolvable value)
The location for the instance, such as the AWS Region and Availability Zone.
|
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 |
setState(CfnInstance.StateProperty value)
The status code and the state (for example, `running` ) of the instance.
|
void |
setState(IResolvable value)
The status code and the state (for example, `running` ) of the instance.
|
void |
setUserData(java.lang.String value)
The optional launch script for the instance.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnInstance(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnInstance(Construct scope, java.lang.String id, 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.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.Number getAttrHardwareCpuCount()
public java.lang.Number getAttrHardwareRamSizeInGb()
public java.lang.String getAttrInstanceArn()
public IResolvable getAttrIsStaticIp()
public java.lang.String getAttrLocationAvailabilityZone()
public java.lang.String getAttrLocationRegionName()
public java.lang.String getAttrNetworkingMonthlyTransferGbPerMonthAllocated()
public java.lang.String getAttrPrivateIpAddress()
public java.lang.String getAttrPublicIpAddress()
public java.lang.String getAttrResourceType()
public java.lang.String getAttrSshKeyName()
public java.lang.Number getAttrStateCode()
public java.lang.String getAttrStateName()
public java.lang.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.
public java.lang.String getAttrUserName()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public TagManager getTags()
For more information, see Tag in the AWS CloudFormation User Guide .
The
Value
ofTags
is optional for Lightsail resources.
public java.lang.String getBlueprintId()
public void setBlueprintId(java.lang.String value)
public java.lang.String getBundleId()
public void setBundleId(java.lang.String value)
public java.lang.String getInstanceName()
public void setInstanceName(java.lang.String value)
public java.lang.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.
public void setAddOns(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.
public void setAddOns(java.util.List<java.lang.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.
public java.lang.String getAvailabilityZone()
public void setAvailabilityZone(java.lang.String value)
public java.lang.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.
public void setHardware(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.
public void setHardware(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.
public java.lang.String getKeyPairName()
If no key pair name is specified, the Regional Lightsail default key pair is used.
public void setKeyPairName(java.lang.String value)
If no key pair name is specified, the Regional Lightsail default key pair is used.
public java.lang.Object getLocation()
The
Location
property is read-only and should not be specified in a create instance or update instance request.
public void setLocation(IResolvable value)
The
Location
property is read-only and should not be specified in a create instance or update instance request.
public void setLocation(CfnInstance.LocationProperty value)
The
Location
property is read-only and should not be specified in a create instance or update instance request.
public java.lang.Object getNetworking()
public void setNetworking(IResolvable value)
public void setNetworking(CfnInstance.NetworkingProperty value)
public java.lang.Object getState()
The
State
property is read-only and should not be specified in a create instance or update instance request.
public void setState(IResolvable value)
The
State
property is read-only and should not be specified in a create instance or update instance request.
public void setState(CfnInstance.StateProperty value)
The
State
property is read-only and should not be specified in a create instance or update instance request.
public java.lang.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
.
public void setUserData(java.lang.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
.