Skip to content

Instance

This class encapsulates and extends the ROS resource type ALIYUN::ECS::Instance, which is used to create an Elastic Compute Service (ECS) instance.

Initializers

import com.aliyun.ros.cdk.ecs.Instance;
Instance.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
    .instanceType(java.lang.String)
    .instanceType(IResolvable)
//  .affinity(java.lang.String)
//  .affinity(IResolvable)
//  .allocatePublicIp(java.lang.Boolean)
//  .allocatePublicIp(IResolvable)
//  .autoRenew(java.lang.String)
//  .autoRenew(IResolvable)
//  .autoRenewPeriod(java.lang.Number)
//  .autoRenewPeriod(IResolvable)
//  .creditSpecification(java.lang.String)
//  .creditSpecification(IResolvable)
//  .dedicatedHostId(java.lang.String)
//  .dedicatedHostId(IResolvable)
//  .deletionProtection(java.lang.Boolean)
//  .deletionProtection(IResolvable)
//  .deploymentSetGroupNo(java.lang.Number)
//  .deploymentSetGroupNo(IResolvable)
//  .deploymentSetId(java.lang.String)
//  .deploymentSetId(IResolvable)
//  .description(java.lang.String)
//  .description(IResolvable)
//  .diskMappings(IResolvable)
//  .diskMappings(java.util.List<IResolvable)
//  .diskMappings(DiskMappingsProperty>)
//  .hostName(java.lang.String)
//  .hostName(IResolvable)
//  .hpcClusterId(java.lang.String)
//  .hpcClusterId(IResolvable)
//  .httpEndpoint(java.lang.String)
//  .httpEndpoint(IResolvable)
//  .httpTokens(java.lang.String)
//  .httpTokens(IResolvable)
//  .imageFamily(java.lang.String)
//  .imageFamily(IResolvable)
//  .imageId(java.lang.String)
//  .imageId(IResolvable)
//  .instanceChargeType(java.lang.String)
//  .instanceChargeType(IResolvable)
//  .instanceName(java.lang.String)
//  .instanceName(IResolvable)
//  .internetChargeType(java.lang.String)
//  .internetChargeType(IResolvable)
//  .internetMaxBandwidthOut(java.lang.Number)
//  .internetMaxBandwidthOut(IResolvable)
//  .ioOptimized(java.lang.String)
//  .ioOptimized(IResolvable)
//  .keyPairName(java.lang.String)
//  .keyPairName(IResolvable)
//  .password(java.lang.String)
//  .password(IResolvable)
//  .passwordInherit(java.lang.Boolean)
//  .passwordInherit(IResolvable)
//  .period(java.lang.Number)
//  .period(IResolvable)
//  .periodUnit(java.lang.String)
//  .periodUnit(IResolvable)
//  .privateIpAddress(java.lang.String)
//  .privateIpAddress(IResolvable)
//  .privatePoolOptions(IResolvable)
//  .privatePoolOptions(PrivatePoolOptionsProperty)
//  .ramRoleName(java.lang.String)
//  .ramRoleName(IResolvable)
//  .resourceGroupId(java.lang.String)
//  .resourceGroupId(IResolvable)
//  .securityEnhancementStrategy(java.lang.String)
//  .securityEnhancementStrategy(IResolvable)
//  .securityGroupId(java.lang.String)
//  .securityGroupId(IResolvable)
//  .securityGroupIds(IResolvable)
//  .securityGroupIds(java.util.List<java.lang.String)
//  .securityGroupIds(IResolvable>)
//  .spotDuration(java.lang.Number)
//  .spotDuration(IResolvable)
//  .spotInterruptionBehavior(java.lang.String)
//  .spotInterruptionBehavior(IResolvable)
//  .spotPriceLimit(java.lang.String)
//  .spotPriceLimit(IResolvable)
//  .spotStrategy(java.lang.String)
//  .spotStrategy(IResolvable)
//  .storageSetId(java.lang.String)
//  .storageSetId(IResolvable)
//  .storageSetPartitionNumber(java.lang.Number)
//  .storageSetPartitionNumber(IResolvable)
//  .systemDiskCategory(java.lang.String)
//  .systemDiskCategory(IResolvable)
//  .systemDiskDescription(java.lang.String)
//  .systemDiskDescription(IResolvable)
//  .systemDiskDiskName(java.lang.String)
//  .systemDiskDiskName(IResolvable)
//  .systemDiskPerformanceLevel(java.lang.String)
//  .systemDiskPerformanceLevel(IResolvable)
//  .systemDiskSize(java.lang.Number)
//  .systemDiskSize(IResolvable)
//  .tags(java.util.List<TagsProperty>)
//  .tenancy(java.lang.String)
//  .tenancy(IResolvable)
//  .useAdditionalService(java.lang.Boolean)
//  .useAdditionalService(IResolvable)
//  .userData(java.lang.String)
//  .userData(IResolvable)
//  .vpcId(java.lang.String)
//  .vpcId(IResolvable)
//  .vSwitchId(java.lang.String)
//  .vSwitchId(IResolvable)
//  .zoneId(java.lang.String)
//  .zoneId(IResolvable)
//  .zoneIds(IResolvable)
//  .zoneIds(java.util.List<java.lang.String)
//  .zoneIds(IResolvable>)
    .build();
Name Type Description
scope com.aliyun.ros.cdk.core.Construct No description.
id java.lang.String No description.
enableResourcePropertyConstraint java.lang.Boolean No description.
instanceType java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property instanceType: Ecs instance supported instance type, make sure it should be correct.
affinity java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property affinity: Specifies whether to associate the instance on a dedicated host with the dedicated host.
allocatePublicIp java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property allocatePublicIp: The public ip for ecs instance, if properties is true, will allocate public ip.
autoRenew java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property autoRenew: Whether renew the fee automatically?
autoRenewPeriod java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property autoRenewPeriod: The time period of auto renew.
creditSpecification java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property creditSpecification: The performance mode of the burstable instance.
dedicatedHostId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property dedicatedHostId: which dedicated host will be deployed.
deletionProtection java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property deletionProtection: Whether an instance can be released manually through the console or API, deletion protection only support postPaid instance.
deploymentSetGroupNo java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property deploymentSetGroupNo: The number of the deployment set group to which to deploy the instance.
deploymentSetId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property deploymentSetId: Deployment set ID.
description java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property description: Description of the instance, [2, 256] characters.
diskMappings com.aliyun.ros.cdk.core.IResolvable OR java.util.ListDiskMappingsProperty> Property diskMappings: Disk mappings to attach to instance.
hostName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property hostName: Host name of created ecs instance.
hpcClusterId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property hpcClusterId: The HPC cluster ID to which the instance belongs.
httpEndpoint java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property httpEndpoint: Specifies whether the access channel is enabled for instance metadata.
httpTokens java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property httpTokens: Specifies whether the security hardening mode (IMDSv2) is forcefully used to access instance metadata.
imageFamily java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property imageFamily: The name of the image family.
imageId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property imageId: Image ID to create ecs instance.
instanceChargeType java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property instanceChargeType: Instance Charge type, allowed value: Prepaid and Postpaid.
instanceName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property instanceName: Display name of the instance, [2, 128] English or Chinese characters, must start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'.
internetChargeType java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property internetChargeType: Instance internet access charge type.Support 'PayByBandwidth' and 'PayByTraffic' only. Default is PayByTraffic.
internetMaxBandwidthOut java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property internetMaxBandwidthOut: Set internet output bandwidth of instance.
ioOptimized java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property ioOptimized: The 'optimized' instance can provide better IO performance.
keyPairName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property keyPairName: SSH key pair name.
password java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property password: Password of created ecs instance.
passwordInherit java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property passwordInherit: Specifies whether to use the password preset in the image.
period java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property period: Prepaid time period.
periodUnit java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property periodUnit: Unit of prepaid time period, it could be Week\/Month\/Year.
privateIpAddress java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property privateIpAddress: Private IP for the instance created.
privatePoolOptions com.aliyun.ros.cdk.core.IResolvable OR PrivatePoolOptionsProperty Property privatePoolOptions: The options of the private pool.
ramRoleName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property ramRoleName: Instance RAM role name.
resourceGroupId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property resourceGroupId: Resource group id.
securityEnhancementStrategy java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property securityEnhancementStrategy:.
securityGroupId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property securityGroupId: Security group to create ecs instance.
securityGroupIds com.aliyun.ros.cdk.core.IResolvable OR java.util.List Property securityGroupIds: The ID list of security group to which to assign the instance.
spotDuration java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property spotDuration: The protection period of the preemptible instance.
spotInterruptionBehavior java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property spotInterruptionBehavior: The interruption mode of the preemptible instance.
spotPriceLimit java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property spotPriceLimit: The hourly price threshold of a instance, and it takes effect only when parameter InstanceChargeType is PostPaid.
spotStrategy java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property spotStrategy: The spot strategy of a Pay-As-You-Go instance, and it takes effect only when parameter InstanceChargeType is PostPaid.
storageSetId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property storageSetId: The storage set ID.
storageSetPartitionNumber java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property storageSetPartitionNumber: The maximum number of partitions in the storage set.
systemDiskCategory java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property systemDiskCategory: Category of system disk.
systemDiskDescription java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property systemDiskDescription: Description of created system disk.
systemDiskDiskName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property systemDiskDiskName: Name of created system disk.
systemDiskPerformanceLevel java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property systemDiskPerformanceLevel: The performance level of the enhanced SSD used as the system disk.Default value: PL1. Valid values:PL0: A single enhanced SSD delivers up to 10,000 random read\/write IOPS.PL1: A single enhanced SSD delivers up to 50,000 random read\/write IOPS.PL2: A single enhanced SSD delivers up to 100,000 random read\/write IOPS.PL3: A single enhanced SSD delivers up to 1,000,000 random read\/write IOPS.
systemDiskSize java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property systemDiskSize: Disk size of the system disk, range from 20 to 500 GB.
tags java.util.List<TagsProperty> Property tags: Tags to attach to instance.
tenancy java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property tenancy: Specifies whether to create the instance on a dedicated host.
useAdditionalService java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property useAdditionalService: Specifies whether to use the system configurations for virtual machines provided by Alibaba Cloud.
userData java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property userData: User data to pass to instance.
vpcId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property vpcId: The VPC id to create ecs instance.
vSwitchId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property vSwitchId: The vSwitch Id to create ecs instance.
zoneId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property zoneId: The ID of the zone to which the instance belongs.
zoneIds com.aliyun.ros.cdk.core.IResolvable OR java.util.List Property zoneIds: Zone ids for query parameters.

scopeRequired

  • Type: com.aliyun.ros.cdk.core.Construct

idRequired

  • Type: java.lang.String

enableResourcePropertyConstraintOptional

  • Type: java.lang.Boolean

instanceTypeRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property instanceType: Ecs instance supported instance type, make sure it should be correct.


affinityOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property affinity: Specifies whether to associate the instance on a dedicated host with the dedicated host.

Valid values:

  • default: does not associate the ECS instance with the dedicated host. When you start an instance that was stopped in economical mode, the instance is automatically deployed to another dedicated host in the automatic deployment resource pool if the available resources of the original dedicated host are insufficient.
  • host: associates the ECS instance with the dedicated host. When you start an instance that was stopped in economical mode, the instance remains on the original dedicated host. If the available resources of the original dedicated host are insufficient, the instance cannot start. Default value: default.

allocatePublicIpOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property allocatePublicIp: The public ip for ecs instance, if properties is true, will allocate public ip.

If property InternetMaxBandwidthOut set to 0, it will not assign public ip.


autoRenewOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property autoRenew: Whether renew the fee automatically?

When the parameter InstanceChargeType is PrePaid, it will take effect. Range of value:True: automatic renewal.False: no automatic renewal. Default value is False.


autoRenewPeriodOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property autoRenewPeriod: The time period of auto renew.

When the parameter InstanceChargeType is PrePaid, it will take effect.It could be 1, 2, 3, 6, 12, 24, 36, 48, 60. Default value is 1.


creditSpecificationOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property creditSpecification: The performance mode of the burstable instance.

Valid values:

  • Standard: the standard mode.
  • Unlimited: the unlimited mode.

dedicatedHostIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property dedicatedHostId: which dedicated host will be deployed.


deletionProtectionOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property deletionProtection: Whether an instance can be released manually through the console or API, deletion protection only support postPaid instance.


deploymentSetGroupNoOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property deploymentSetGroupNo: The number of the deployment set group to which to deploy the instance.

If the deployment set specified by DeploymentSetId uses the high availability group strategy (AvailabilityGroup), you can use DeploymentSetGroupNo to specify a deployment set group in the deployment set. Valid values: 1 to 7.


deploymentSetIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property deploymentSetId: Deployment set ID.


descriptionOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property description: Description of the instance, [2, 256] characters.

Do not fill or empty, the default is empty.


diskMappingsOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.ListDiskMappingsProperty>

Property diskMappings: Disk mappings to attach to instance.

Max support 16 disks. If the image contains a data disk, you can specify other parameters of the data disk via the same value of parameter "Device". If parameter "Category" is not specified, it will be cloud_efficiency instead of "Category" of data disk in the image.


hostNameOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property hostName: Host name of created ecs instance.

at least 2 characters, and '.' '-' Is not the first and last characters as hostname, not continuous use. Windows platform can be up to 15 characters, allowing letters (without limiting case), numbers and '-', and does not support the number of points, not all is digital ('.').Other (Linux, etc.) platform up to 64 characters, allowing support number multiple points for the period between the points, each permit letters (without limiting case), numbers and '-' components.


hpcClusterIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property hpcClusterId: The HPC cluster ID to which the instance belongs.


httpEndpointOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property httpEndpoint: Specifies whether the access channel is enabled for instance metadata.

Valid values:

  • enabled
  • disabled Default value: enabled.

httpTokensOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property httpTokens: Specifies whether the security hardening mode (IMDSv2) is forcefully used to access instance metadata.

Valid values:

  • optional: does not forcefully use the security-enhanced mode (IMDSv2).
  • required: forcefully uses the security-enhanced mode (IMDSv2). After you set this parameter to required, you cannot access instance metadata in normal mode. Default value: optional.

imageFamilyOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property imageFamily: The name of the image family.

You can set this parameter to obtain the latest available custom image from the specified image family to create the instance.

  • ImageFamily must be empty if ImageId is specified.
  • ImageFamily can be specified if ImageId is not specified.

imageIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property imageId: Image ID to create ecs instance.


instanceChargeTypeOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property instanceChargeType: Instance Charge type, allowed value: Prepaid and Postpaid.

If specified Prepaid, please ensure you have sufficient balance in your account. Or instance creation will be failure. Default value is Postpaid.


instanceNameOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property instanceName: Display name of the instance, [2, 128] English or Chinese characters, must start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'.


internetChargeTypeOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property internetChargeType: Instance internet access charge type.Support 'PayByBandwidth' and 'PayByTraffic' only. Default is PayByTraffic.


internetMaxBandwidthOutOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property internetMaxBandwidthOut: Set internet output bandwidth of instance.

Unit is Mbps(Mega bit per second). Range is [0,200]. Default is 1.While the property is not 0, public ip will be assigned for instance.


ioOptimizedOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property ioOptimized: The 'optimized' instance can provide better IO performance.

Support 'none' and 'optimized' only, default is 'optimized'.


keyPairNameOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property keyPairName: SSH key pair name.


passwordOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property password: Password of created ecs instance.

Must contain at least 3 types of special character, lower character, upper character, number.


passwordInheritOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property passwordInherit: Specifies whether to use the password preset in the image.

To use the PasswordInherit parameter, the Password parameter must be empty and you must make sure that the selected image has a password configured.


periodOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property period: Prepaid time period.

Unit is month, it could be from 1 to 9 or 12, 24, 36, 48, 60. Default value is 1.


periodUnitOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property periodUnit: Unit of prepaid time period, it could be Week\/Month\/Year.

Default value is Month.


privateIpAddressOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property privateIpAddress: Private IP for the instance created.

Only works for VPC instance and cannot duplicated with existing instance.


privatePoolOptionsOptional

Property privatePoolOptions: The options of the private pool.


ramRoleNameOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property ramRoleName: Instance RAM role name.

The name is provided and maintained by Resource Access Management (RAM) and can be queried using ListRoles. For more information, see RAM API CreateRole and ListRoles.


resourceGroupIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property resourceGroupId: Resource group id.


securityEnhancementStrategyOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property securityEnhancementStrategy:.


securityGroupIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property securityGroupId: Security group to create ecs instance.

For classic instance need the security group not belong to VPC, for VPC instance, please make sure the security group belong to specified VPC.


securityGroupIdsOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List

Property securityGroupIds: The ID list of security group to which to assign the instance.

The max length is based on the maximum number of security groups to which an instance can belong. For more information, see the "Security group limits" section in Limits.


spotDurationOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property spotDuration: The protection period of the preemptible instance.

Unit: hours. Valid values: 0, 1, 2, 3, 4, 5, and 6. Protection periods of 2, 3, 4, 5, and 6 hours are in invitational preview. If you want to set this parameter to one of these values, submit a ticket. If this parameter is set to 0, no protection period is configured for the preemptible instance. Default value: 1.


spotInterruptionBehaviorOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property spotInterruptionBehavior: The interruption mode of the preemptible instance.

Default value: Terminate. Set the value to Terminate, which specifies to release the instance.


spotPriceLimitOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property spotPriceLimit: The hourly price threshold of a instance, and it takes effect only when parameter InstanceChargeType is PostPaid.

Three decimals is allowed at most.


spotStrategyOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property spotStrategy: The spot strategy of a Pay-As-You-Go instance, and it takes effect only when parameter InstanceChargeType is PostPaid.

Value range: "NoSpot: A regular Pay-As-You-Go instance", "SpotWithPriceLimit: A price threshold for a spot instance, ""SpotAsPriceGo: A price that is based on the highest Pay-As-You-Go instance. "Default value: NoSpot.


storageSetIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property storageSetId: The storage set ID.


storageSetPartitionNumberOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property storageSetPartitionNumber: The maximum number of partitions in the storage set.

The value must be greater than or equal to 2.


systemDiskCategoryOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property systemDiskCategory: Category of system disk.

Default is cloud_efficiency. support cloud|cloud_efficiency|cloud_ssd|cloud_essd|ephemeral_ssd|cloud_auto|cloud_essd_entry


systemDiskDescriptionOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property systemDiskDescription: Description of created system disk.


systemDiskDiskNameOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property systemDiskDiskName: Name of created system disk.


systemDiskPerformanceLevelOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property systemDiskPerformanceLevel: The performance level of the enhanced SSD used as the system disk.Default value: PL1. Valid values:PL0: A single enhanced SSD delivers up to 10,000 random read\/write IOPS.PL1: A single enhanced SSD delivers up to 50,000 random read\/write IOPS.PL2: A single enhanced SSD delivers up to 100,000 random read\/write IOPS.PL3: A single enhanced SSD delivers up to 1,000,000 random read\/write IOPS.


systemDiskSizeOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property systemDiskSize: Disk size of the system disk, range from 20 to 500 GB.

If you specify with your own image, make sure the system disk size bigger than image size.


tagsOptional

Property tags: Tags to attach to instance.

Max support 20 tags to add during create instance. Each tag with two properties Key and Value, and Key is required.


tenancyOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property tenancy: Specifies whether to create the instance on a dedicated host.

Valid values:

  • default: creates the instance on a non-dedicated host.
  • host: creates the instance on a dedicated host. If you do not specify DedicatedHostId, Alibaba Cloud selects a dedicated host for the instance. Default value: default.

useAdditionalServiceOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property useAdditionalService: Specifies whether to use the system configurations for virtual machines provided by Alibaba Cloud.

System configurations for Windows: NTP and KMS. System configurations for Linux: NTP and YUM.


userDataOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property userData: User data to pass to instance.

[1, 16KB] characters.User data should not be base64 encoded. If you want to pass base64 encoded string to the property, use function Fn::Base64Decode to decode the base64 string first.


vpcIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property vpcId: The VPC id to create ecs instance.


vSwitchIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property vSwitchId: The vSwitch Id to create ecs instance.


zoneIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property zoneId: The ID of the zone to which the instance belongs.

For more information, call the DescribeZones operation to query the most recent zone list. Default value is empty, which means random selection.


zoneIdsOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List

Property zoneIds: Zone ids for query parameters.


Methods

Name Description
toString Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
addCondition No description.
addCount No description.
addDependency No description.
addResourceDesc No description.
applyRemovalPolicy No description.
getAtt No description.
setMetadata No description.
addSecurityGroups Add one or more security groups to an ECS instance.
addUserDataCommands Add one or more commands to the userdata of an ECS instance.
autoCreateDependencies Create prerequisite resource(s) required to an ECS instance: VPC, VSwitch, and(or) security group.

toString

public java.lang.String toString()

Returns a string representation of this construct.

synthesize

public void synthesize(ISynthesisSession session)

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

  • Type: com.aliyun.ros.cdk.core.ISynthesisSession

The synthesis session.


addCondition

public void addCondition(RosCondition condition)

conditionRequired

  • Type: com.aliyun.ros.cdk.core.RosCondition

addCount

public void addCount(java.lang.Number OR IResolvable count)

countRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

addDependency

public void addDependency(Resource resource)

resourceRequired

  • Type: com.aliyun.ros.cdk.core.Resource

addResourceDesc

public void addResourceDesc(java.lang.String desc)

descRequired

  • Type: java.lang.String

applyRemovalPolicy

public void applyRemovalPolicy(RemovalPolicy policy)

policyRequired

  • Type: com.aliyun.ros.cdk.core.RemovalPolicy

getAtt

public IResolvable getAtt(java.lang.String name)

nameRequired

  • Type: java.lang.String

setMetadata

public void setMetadata(java.lang.String key, java.lang.Object value)

keyRequired

  • Type: java.lang.String

valueRequired

  • Type: java.lang.Object

addSecurityGroups

public void addSecurityGroups(java.lang.String OR SecurityGroup securityGroups)

Add one or more security groups to an ECS instance.

securityGroupsRequired

Security groups or security group IDs.


addUserDataCommands

public void addUserDataCommands(java.lang.String OR IResolvable commands)

Add one or more commands to the userdata of an ECS instance.

commandsRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Commands to be added.


autoCreateDependencies

public java.util.List<java.lang.Object> autoCreateDependencies()
public java.util.List<java.lang.Object> autoCreateDependencies(java.lang.String OR IResolvable zoneId)
public java.util.List<java.lang.Object> autoCreateDependencies(java.lang.String OR IResolvable zoneId, java.lang.String vpcCidrBlock)
public java.util.List<java.lang.Object> autoCreateDependencies(java.lang.String OR IResolvable zoneId, java.lang.String vpcCidrBlock, java.lang.String vSwitchCidrBlock)
public java.util.List<java.lang.Object> autoCreateDependencies(java.lang.String OR IResolvable zoneId, java.lang.String vpcCidrBlock, java.lang.String vSwitchCidrBlock, java.lang.Boolean whetherCreateSecurityGroup)

Create prerequisite resource(s) required to an ECS instance: VPC, VSwitch, and(or) security group.

zoneIdOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Required when creating a VSwitch.


vpcCidrBlockOptional

  • Type: java.lang.String

Optional when creating a VPC.

Default value is 192.168.0.0/16.


vSwitchCidrBlockOptional

  • Type: java.lang.String

Optional when creating a VSwitch.

Default value is 192.168.0.0/24.


whetherCreateSecurityGroupOptional

  • Type: java.lang.Boolean

Whether to create a security group.

Default value is true.


Static Functions

Name Description
isConstruct Return whether the given object is a Construct.

isConstruct

import com.aliyun.ros.cdk.ecs.Instance;
Instance.isConstruct(java.lang.Object x)

Return whether the given object is a Construct.

xRequired

  • Type: java.lang.Object

Properties

Name Type Description
node com.aliyun.ros.cdk.core.ConstructNode The construct tree node associated with this construct.
ref java.lang.String No description.
stack com.aliyun.ros.cdk.core.Stack The stack in which this resource is defined.
resource com.aliyun.ros.cdk.core.RosResource No description.
attrHostName com.aliyun.ros.cdk.core.IResolvable Attribute HostName: Host name of created instance.
attrInnerIp com.aliyun.ros.cdk.core.IResolvable Attribute InnerIp: Inner IP address of the specified instance.
attrInstanceId com.aliyun.ros.cdk.core.IResolvable Attribute InstanceId: The instance ID of created ecs instance.
attrPrimaryNetworkInterfaceId com.aliyun.ros.cdk.core.IResolvable Attribute PrimaryNetworkInterfaceId: Primary network interface ID of created instance.
attrPrivateIp com.aliyun.ros.cdk.core.IResolvable Attribute PrivateIp: Private IP address of created ecs instance.
attrPublicIp com.aliyun.ros.cdk.core.IResolvable Attribute PublicIp: Public IP address of created ecs instance.
attrSecurityGroupIds com.aliyun.ros.cdk.core.IResolvable Attribute SecurityGroupIds: Security group ID list of created instance.
attrZoneId com.aliyun.ros.cdk.core.IResolvable Attribute ZoneId: Zone ID of created instance.

nodeRequired

public ConstructNode getNode();
  • Type: com.aliyun.ros.cdk.core.ConstructNode

The construct tree node associated with this construct.


refRequired

public java.lang.String getRef();
  • Type: java.lang.String

stackRequired

public Stack getStack();
  • Type: com.aliyun.ros.cdk.core.Stack

The stack in which this resource is defined.


resourceOptional

public RosResource getResource();
  • Type: com.aliyun.ros.cdk.core.RosResource

attrHostNameRequired

public IResolvable getAttrHostName();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute HostName: Host name of created instance.


attrInnerIpRequired

public IResolvable getAttrInnerIp();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute InnerIp: Inner IP address of the specified instance.

Only for classical instance.


attrInstanceIdRequired

public IResolvable getAttrInstanceId();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute InstanceId: The instance ID of created ecs instance.


attrPrimaryNetworkInterfaceIdRequired

public IResolvable getAttrPrimaryNetworkInterfaceId();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute PrimaryNetworkInterfaceId: Primary network interface ID of created instance.


attrPrivateIpRequired

public IResolvable getAttrPrivateIp();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute PrivateIp: Private IP address of created ecs instance.

Only for VPC instance.


attrPublicIpRequired

public IResolvable getAttrPublicIp();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute PublicIp: Public IP address of created ecs instance.


attrSecurityGroupIdsRequired

public IResolvable getAttrSecurityGroupIds();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute SecurityGroupIds: Security group ID list of created instance.


attrZoneIdRequired

public IResolvable getAttrZoneId();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute ZoneId: Zone ID of created instance.