ALIYUN::ECS::Instance is used to create an Elastic Compute Service (ECS) instance.
Syntax
{
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"DedicatedHostId": String,
"Period": Number,
"AutoRenew": String,
"RamRoleName": String,
"IoOptimized": String,
"InternetChargeType": String,
"PrivateIpAddress": String,
"KeyPairName": String,
"SystemDiskDiskName": String,
"PeriodUnit": String,
"Description": String,
"Tags": List,
"HostName": String,
"AutoRenewPeriod": Number,
"ImageId": String,
"ResourceGroupId": String,
"InstanceChargeType": String,
"VSwitchId": String,
"Password": String,
"PasswordInherit": Boolean,
"InstanceType": String,
"SystemDiskCategory": String,
"UserData": String,
"SystemDiskSize": Number,
"ZoneId": String,
"InternetMaxBandwidthOut": Integer,
"VpcId": String,
"SpotStrategy": String,
"InstanceName": String,
"DeletionProtection": Boolean,
"DeploymentSetId": String,
"SecurityGroupIds": List,
"SecurityGroupId": String,
"SecurityEnhancementStrategy": String,
"SpotPriceLimit": String,
"HpcClusterId": String,
"AllocatePublicIP": Boolean,
"SystemDiskDescription": String,
"SystemDiskPerformanceLevel": String,
"DiskMappings": List,
"SpotInterruptionBehavior": String,
"ZoneIds": List,
"SpotDuration": Integer,
"CreditSpecification": String,
"PrivatePoolOptions": Map,
"StorageSetId": String,
"HttpTokens": String,
"HttpEndpoint": String,
"Tenancy": String,
"StorageSetPartitionNumber": Integer,
"DeploymentSetGroupNo": Integer,
"Affinity": String,
"UseAdditionalService": Boolean,
"ImageFamily": String
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
ResourceGroupId | String | No | Yes | The ID of the resource group. | None. |
SpotInterruptionBehavior | String | No | No | The interruption mode of the preemptible instance. | Set the value to Terminate. A value of Terminate specifies that the system directly releases preemptible instances. Default value: Terminate. |
ZoneIds | List | No | No | The zone IDs. | None. |
SpotDuration | Integer | No | No | The protection period of the preemptible instance. | Valid values: 0 to 6. Unit: hour.
|
SecurityGroupIds | List | No | No | The IDs of the security groups. | You must specify SecurityGroupId or SecurityGroupIds. |
ImageId | String | No | Yes | The image ID. You can use a public image, a custom image, or an Alibaba Cloud Marketplace image. | Public images support fuzzy match. To specify a public image, you can enter a partial image ID. Examples:
|
InstanceType | String | Yes | Yes | The ECS instance type. | For more information about ECS instance types, see Overview of instance families. |
SecurityGroupId | String | No | No | The ID of the security group. | You must specify SecurityGroupId or SecurityGroupIds. |
SecurityEnhancementStrategy | String | No | No | Specifies whether to enable security hardening. | Valid values:
|
Description | String | No | Yes | The description. | The description must be 2 to 256 characters in length. |
InstanceName | String | No | Yes | The instance name. | The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with If you leave this property empty, the instance ID is used by default. |
Password | String | No | Yes | The password that you want to use to log on to the ECS instance. | The password must be 8 to 30 characters in length. The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The following special characters are supported: |
PasswordInherit | Boolean | No | No | Specifies whether to use the preset password of the image. | Valid values:
Note If you set this property to true, you must leave Password empty and make sure that the selected image has a preset password. |
HostName | String | No | Yes | The hostname of the ECS instance. | The hostname must be at least two characters in length. The hostname cannot start or end with a period (.) or hyphen (-), or contain consecutive periods (.) or hyphens (-).
|
AllocatePublicIP | Boolean | No | No | Specifies whether to assign a public IP address. | Valid values:
Note If you set InternetMaxBandwidthOut to a value that is greater than 0, the system assigns a public IP address. |
PrivateIpAddress | String | No | No | The private IP address of the ECS instance in a virtual private cloud (VPC). | The specified IP address must not be used by other instances in the VPC. |
InternetChargeType | String | No | Yes | The metering method for Internet usage. | Valid values:
|
InternetMaxBandwidthOut | Integer | No | Yes | The maximum outbound public bandwidth. | Valid values: 0 to 100. Default value: 0. Unit: Mbit/s. |
IoOptimized | String | No | No | Specifies whether to create an I/O optimized instance. | Valid values:
|
DiskMappings | List | No | Yes | The data disks that you want to attach to the ECS instance. | You can attach up to 16 data disks. For more information, see DiskMappings syntax and DiskMappings properties. |
SystemDiskCategory | String | No | Yes | The category of the system disk. | Valid values:
For non-I/O optimized instances of a retired instance type, the default value is cloud. For instances of other types, the default value is cloud_efficiency. |
SystemDiskDescription | String | No | No | The description of the system disk. | None. |
SystemDiskDiskName | String | No | No | The name of the system disk. | The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with |
SystemDiskSize | Number | No | Yes | The size of the system disk. | Valid values: 20 to 500. Unit: GB. If you use a custom image to create a system disk, you must make sure that the size of the system disk is larger than the size of the custom image. |
Tags | List | No | Yes | The custom tags that you want to add to the ECS instance. | You can specify up to 20 tags in the following format: For more information, see Tags syntax and Tags properties. |
UserData | String | No | Yes | The user data that you want to specify when you create the ECS instance. | The user data can be up to 16 KB in size. You do not need to convert the data into Base64-encoded strings. If the user data contains special characters, you must add the escape character (\) before each special character. |
ZoneId | String | No | No | The zone ID. | None. |
HpcClusterId | String | No | No | The ID of the Elastic High Performance Computing (E-HPC) cluster to which the ECS instance belongs. | None. |
VpcId | String | No | No | The VPC ID. | None. |
VSwitchId | String | No | No | The vSwitch ID. | None. |
InstanceChargeType | String | No | No | The billing method of the ECS instance. | Valid values:
|
Period | Number | No | No | The billing cycle of the ECS instance. | Period is required when InstanceChargeType is set to PrePaid. Period is optional when InstanceChargeType is set to PostPaid. |
KeyPairName | String | No | Yes | The name of the key pair that you want to use to log to the ECS instance. | For ECS Windows instances, you can ignore KeyPairName. For ECS Linux instances, password-based logons are disabled during initialization. To enhance the security of the instance, we recommend that you use key pairs for logons. |
RamRoleName | String | No | No | The name of the Resource Access Management (RAM) role for the ECS instance. | For more information, see CreateRole and ListRoles. |
SpotPriceLimit | String | No | No | The maximum hourly price of the ECS instance. | The value of this property can contain up to three decimal places. This property takes effect when SpotStrategy is set to SpotWithPriceLimit. |
SpotStrategy | String | No | No | The bidding policy for the pay-as-you-go instance. | You must specify this property when InstanceChargeType is set to PostPaid. Valid values:
|
DedicatedHostId | String | No | No | The ID of the dedicated host on which you want to create the ECS instance. | You can call the DescribeDedicatedHosts operation to query the IDs of dedicated hosts. You cannot create preemptible instances on dedicated hosts. If you specify this property, the system ignores SpotStrategy and SpotPriceLimit in the request. |
PeriodUnit | String | No | No | The unit of the subscription duration. | Valid values:
|
AutoRenewPeriod | Number | No | No | The auto-renewal period. | You must specify this property when AutoRenew is set to True.
|
AutoRenew | String | No | No | Specifies whether to enable auto-renewal. | Valid values:
You must specify this property when InstanceChargeType is set to PrePaid. |
DeletionProtection | Boolean | No | Yes | The deletion protection property for the ECS instance. You can use this property to specify whether you can delete the ECS instance in the ECS console or by calling the DeleteInstance operation. | Valid values:
Note This property takes effect only for pay-as-you-go instances. This property can protect instances against manual deletion, but cannot protect instances against automatic deletion. |
DeploymentSetId | String | No | No | The ID of the deployment set. | None. |
SystemDiskPerformanceLevel | String | No | Yes | The performance level (PL) of the ESSD that you want to use as the system disk. | Valid values:
For more information about how to select the PL of the ESSD, see ESSDs. |
CreditSpecification
| String | No | Yes | The performance mode of the burstable instance. | Valid values: |
PrivatePoolOptions | Map | No | No | The options of the private pool to use to start the ECS instance. | For more information, see PrivatePoolOptions properties. |
StorageSetId | String | No | No | The ID of the storage set. | None. |
HttpTokens | String | No | Yes | Specifies whether to forcefully use the security hardening mode (IMDSv2) to access the instance metadata. | Valid values:
Note For more information about the access modes of instance metadata, see Access mode of instance metadata. |
HttpEndpoint | String | No | Yes | Specifies whether to enable the access channel for the instance metadata. | Valid values:
Note For more information about instance metadata, see Overview of ECS instance metadata. |
Tenancy | String | No | No | Specifies whether to create the instance on a dedicated host. | Valid values:
|
StorageSetPartitionNumber | Integer | No | No | The maximum number of partitions in the storage set. | The value must be greater than or equal to 2. |
DeploymentSetGroupNo | Integer | No | No | The group 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. |
Affinity | String | No | No | Specifies whether to associate the instance on a dedicated host with the dedicated host. | Valid values:
|
UseAdditionalService | Boolean | No | No | Specifies whether to use the system configurations for virtual machines. Alibaba Cloud provides the Network Time Protocol (NTP) and Key Management Service (KMS) system configurations for Windows and the NTP and Yellowdog Updater, Modified (YUM) system configurations for Linux. | Valid values:
|
ImageFamily | String | No | No | The name of the image family. | You can specify this property to query the latest available image that belongs to the specified image family and use the image to create an instance.
Note For more information about the image families that are associated with Alibaba Cloud official images, see Overview. |
DiskMappings syntax
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Device": String,
"SnapshotId": String,
"PerformanceLevel": String,
"Size": String
}
]
DiskMappings properties
Property | Type | Required | Editable | Description | Constraint |
Size | String | Yes | No | The size of the data disk. | Valid values: 20 to 500. Unit: GB. |
Category | String | No | No | The category of the data disk. | Valid values:
For I/O optimized instances, the default value is cloud_efficiency. For non-I/O optimized instances, the default value is cloud. If a custom image contains a data disk, you can change the disk category by setting Category to a desired data disk category in a ROS template when you create an ECS instance. Sample template:
|
DiskName | String | No | No | The name of the data disk. | The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with |
Description | String | No | No | The description. | The description must be 2 to 256 characters in length, and cannot start with |
Device | String | No | No | The mount target. | None. |
PerformanceLevel | String | No | No | The PL of the ESSD that you want to use as the data disk. | Valid values:
For more information about how to select the PL of the ESSD, see ESSDs. |
SnapshotId | String | No | No | The ID of the snapshot that you want to use for the data disk. | None. |
Tags syntax
"Tags": [
{
"Value": String,
"Key": String
}
]
Tags properties
Property | Type | Required | Editable | Description | Constraint |
Key | String | Yes | No | The tag key. | The tag key must be 1 to 128 characters in length, and cannot contain |
Value | String | No | No | The tag value. | The tag value can be up to 128 characters in length, and cannot contain |
PrivatePoolOptions syntax
"PrivatePoolOptions": [
{
"Id": String,
"MatchCriteria": String
}
]
PrivatePoolOptions properties
Property | Type | Required | Editable | Description | Constraint |
Id | String | No | No | The ID of the private pool. The ID of a private pool is the same as the ID of the elasticity assurance or capacity reservation for which the private pool is generated. | None. |
MatchCriteria | String | No | No | The type of the private pool to use to start the instance. A private pool is generated after an elasticity assurance or a capacity reservation takes effect. | Valid values:
PrivatePoolOptions.MatchCriteria must be set to
|
Return values
Fn::GetAtt
InstanceId: the ID of the ECS instance. The instance ID is a GUID that is generated by the system for an instance.
PrivateIp: the private IP address of the ECS instance in a VPC.
InnerIp: the private IP address of the ECS instance in the classic network.
PublicIp: the public IP address of the ECS instance in the classic network.
ZoneId: the zone ID of the ECS instance.
HostName: the hostname of the ECS instance.
PrimaryNetworkInterfaceId: the ID of the primary elastic network interface (ENI) that is attached to the ECS instance.
SecurityGroupIds: the IDs of the security groups to which the ECS instance belongs.
Examples
The following sample code provides examples on how to create the OpsEcsInstance and ProdEcsInstance ECS instances and configure the password-free logon of the OpsEcsInstance instance for the ProdEcsInstance instance.
If you want to receive signals of the execution results of user-data scripts of the ECS instances, you can configure ALIYUN::ROS::WaitCondition and ALIYUN::ROS::WaitConditionHandle. For more information, see ALIYUN::ROS::WaitConditionHandle and ALIYUN::ROS::WaitCondition.