edit-icon download-icon

ALIYUN::ECS::Instance

Last Updated: Nov 23, 2018

The ALIYUN::ECS::Instance type can be used to create an ECS instance.

Syntax

  1. {
  2. "Type" : "ALIYUN::ECS::Instance",
  3. "Properties" : {
  4. "DiskMappings" : List,
  5. "IoOptimized" : String,
  6. "InternetChargeType" : String,
  7. "PrivateIpAddress" : String,
  8. "SystemDiskDiskName" : String,
  9. "VpcId" : String,
  10. "Description" : String,
  11. "Tags" : List,
  12. "HostName" : String,
  13. "ImageId" : String,
  14. "InstanceChargeType" : String,
  15. "VSwitchId" : String,
  16. "Password" : String,
  17. "InstanceType" : String,
  18. "SystemDiskCategory" : String,
  19. "SystemDiskSize" : Integer,
  20. "ZoneId" : String,
  21. "InternetMaxBandwidthOut" : Integer,
  22. "InstanceName" : String,
  23. "InternetMaxBandwidthIn" : Integer,
  24. "UserData" : String,
  25. "SecurityGroupId" : String,
  26. "Period" : Integer,
  27. "AllocatePublicIP" : Boolean,
  28. "SystemDiskDescription" : String,
  29. "KeyPairName": String
  30. }
  31. }

Attributes

Attribute name Type Required Update allowed Description Constraint
ImageId string Yes Yes ID of the image used to start the ECS instance. The image can be a public image, custom image, or marketplace image ECS public image list
Specify a public image ID in a fuzzy manner, not a complete public image ID. Generally, to deploy an ECS instance, select the image type and version. You can specify the image type and version or specify the image type where a template is required. ROS automatically selects a proper public image ID. In the image ID for fuzzy search, you can replace some part of the image ID with the wildcard character asterisk ()
Take all Ubuntu public images provided in Alibaba Cloud as an example:
ubuntu_14_0405_32_40G_alibase_20170711.vhd
ubuntu_14_0405_32_40G_alibase_20170711.vhd
ubuntu_14_0405_64_20G_alibase_20170824.vhd
ubuntu_16_0402_32_40G_alibase_20170711.vhd
ubuntu_16_0402_64_20G_alibase_20170818.vhd
To specify the public image ID for ECS, follow the methods below:
Specify: ubuntu
Match: ubuntu_16_0402_64_20G_alibase_20170818.vhd
Specify: ubuntu_14
Match: ubuntu_14_0405_64_20G_alibase_20170824.vhd
Specify: ubuntu
1432
Match: ubuntu14_0405_32_40G_alibase_20170711.vhd
Specify: ubuntu_16_0402_32
Match: ubuntu_16_0402_32_40G_alibase_20170711.vhd
InstanceType string Yes No ECS instance type List of ECS instance types
SecurityGroupId string Yes No ID of the security group to which the created instance belongs None
Description string No No Description The description can contain a maximum of 256 characters
InstanceName string No No The instance name. The instance name can contain a maximum of 128 characters including English letters and Chinese characters, numbers, ‘‘, ‘.’, and ‘-‘
Password string No No ECS instance logon password Instance password. The password is a string of 8 to 30 characters and must contain uppercase/lowercase letters, numbers, and special characters. The supported special characters are ( ), `, ~, !, @ # $ % ^ & - + = | { } [ ] : ; ‘ < > , . ? /. If the Password parameter is input, use HTTPS to call the API to avoid password leakage
HostName string No No Host name. This parameter indicates the host name of an ECS instance. It is a string of at least two characters. “hostname” cannot start or end with “.” or “-“. In addition, consecutive “.” or “-“ symbols are not allowed. In Windows, the host name can contain a maximum of 15 characters including uppercase/lowercase letters, numbers, and “-“. It cannot contain periods (.) or contain only numbers. In other OSs such as Linux, the host name can contain a maximum of 30 characters which can be separated by periods (.) into segments, and each segment can contain uppercase/lowercase letters, numbers, and “_”
AllocatePublicIP boolean No No Whether to create public IP addresses. No public IP addresses are assigned if InternetMaxBandwidthOut is set to 0. The default value is “true”
PrivateIpAddress string No No Intranet IP address in the VPC. The IP address cannot be the same as the IP addresses of other instances in VPC None
InternetChargeType string No No Bandwidth billing method for access over the Internet; default value: PayByTraffic Value options: PayByBandwidth and PayByTraffic
InternetMaxBandwidthIn integer No No Maximum Internet inbound bandwidth, in Mbps Value range: [1, 100]; default value: 100
InternetMaxBandwidthOut integer No No Maximum Internet outbound bandwidth, in Mbps Value range in PayByBandwidth mode: [0, 200]; default value: 0. Value range in PayByTraffic mode: [1, 200]. This parameter must be specified in PayByTraffic mode
IoOptimized string No No Whether to create an I/O optimized instance Value options: none (non-I/O optimized) and optimized (I/O optimized); default value: none
DiskMappings list No No Disk you want to attach Up to four disks can be attached
SystemDiskCategory string No No System disk type Value options: cloud, cloud_efficiency, cloud_ssd, and ephemeral_ssd
SystemDiskDescription string No No System disk description None
SystemDiskDiskName string No No System disk name None
SystemDiskSize string No No System disk size Value range: [40, 500]GB. If a custom image is used to create a system disk, make sure that the system disk size is greater than the image size
Tags list No No Custom tag Up to four tags are supported, in the format of [{“Key”:”tagKey”,”Value”:”tagValue”},{“Key”:”tagKey2”,”Value”:”tagValue2”}]
UserData string No No User data that is input during ECS instance creation. The user data size cannot exceed 16 KB
ZoneId string No No Zone ID None
VpcId string No No VPC ID None
VSwitchId string No No VSwitch ID None
InstanceChargeType string No No Billing method for the ECS instance, which can be Pay-As-You-Go or prepayment Value options: Prepaid and Postpaid. Default value: Postpaid. If this parameter is set to Prepaid, make sure you have sufficient balance in your account; otherwise, instance creation fails
Period integer No No Payment cycle. This parameter must be set when InstanceChargeType is set to Prepaid. When InstanceChargeType is set to Postpaid, this parameter is ignored Value options: 1–9, 12, 24, and 36; unit: month
KeyPairName string No No Name of the key pair bound to the ECS instance. This parameter is ignored if the key pair is bound to a Windows ECS instance. It is null by default. If this parameter is set, the value of the Password parameter will be set to the instance. However, the password logon mode in Linux will be initialized to be disabled. None

DiskMappings syntax

  1. "DiskMappings" : [
  2. {
  3. "Category" : String,
  4. "DiskName" : String,
  5. "Description" : String,
  6. "Device" : String,
  7. "SnapshotId" : String,
  8. "Size" : String
  9. }
  10. ]

DiskMappings attributes

Attribute name Type Required Update allowed Description Constraint
Size string Yes No Data disk size, in GB None
Category string No No Data disk type Value options: cloud, cloudefficiency, cloud_ssd, and ephemeral_ssdDefault
DiskName string No No Data disk name The data disk name can contain a maximum of 128 characters including Chinese and English characters, numbers, ‘‘, ‘.’, and ‘-‘
Description string No No Description Value range: [2, 256]; default value: null
Device string No No Device name of the data disk in the ECS instance Example: /dev/xvd[a-z]
SnapshotId string No No ID of the snapshot used to create the data disk None

Tags syntax

  1. "Tags" : [
  2. {
  3. "Value" : String,
  4. "Key" : String
  5. }
  6. ]

Tags attributes

Attribute name Type Required Update allowed Description Constraint
Key string Yes No None None
Value string No No None None

Return values

Fn::GetAtt

  • InstanceId: ID of the instance, which is generated by the system and globally unique. It is a unique identifier of the instance.

  • PrivateIp: Private IP address of a VPC type instance. This parameter is effective when NetworkType is VPC.

  • InnerIp: Private IP address of a Classic type instance. This parameter is effective when NetworkType is Classic.

  • PublicIp: List of the public IP addresses of Classic type instances. This parameter is effective when NetworkType is Classic.

  • ZoneId: Zone ID.

Example

  1. {
  2. "ROSTemplateFormatVersion" : "2015-09-01",
  3. "Resources" : {
  4. "WebServer": {
  5. "Type": "ALIYUN::ECS::Instance",
  6. "Properties": {
  7. "ImageId" : "m-25l0rcfjo",
  8. "InstanceType": "ecs.t1.small",
  9. "SecurityGroupId": "sg-25zwc3se0",
  10. "ZoneId": "cn-beijing-b",
  11. "Tags": [{
  12. "Key": "tiantt",
  13. "Value": "ros"
  14. },{
  15. "Key": "tiantt1",
  16. "Value": "ros1"
  17. }
  18. ]
  19. }
  20. }
  21. },
  22. "Outputs": {
  23. "InstanceId": {
  24. "Value" : {"get_attr": ["WebServer","InstanceId"]}
  25. },
  26. "PublicIp": {
  27. "Value" : {"get_attr": ["WebServer","PublicIp"]}
  28. }
  29. }
  30. }
Thank you! We've received your feedback.