The ALIYUN::ECS::InstanceGroup type can be used to create a set of ECS instances.

Syntax

{
  "Type":"ALIYUN::ECS::InstanceGroup",
  "Properties":{
    "SecurityGroupId":String,
    "ImageId":String,
    "InstanceType":String,
    "InstanceName":String,
    "Description":String,
    "HostName":String,
    "Password":String,
    "IoOptimized":String,
    "ZoneId":String,
    "InternetChargeType":String,
    "InternetMaxBandwidthIn":Integer,
    "InternetMaxBandwidthOut":Integer,
    "VpcId":String,
    "VSwitchId":String,
    "MaxAmount":Integer,
    "MixAmount":Integer,
    "AllocatePublicIP":Boolean,
    "AutoReleaseTime":String,
    "DiskMappings":List,
    "NetworkType":String,
    "PrivateIpAddress":String,
    "SystemDiskCategory":String,
    "SystemDiskDescription":String,
    "SystemDiskDiskName":String,
    "SystemDiskSize":Integer,
    "Tags":List,
    "UserData":String,
    "KeyPairName": String,
    "RamRoleName": String,
    "SpotPriceLimit": String,
    "SpotStrategy": String
  }
}

Attributes

Attribute name Type Required Update allowed Description Constraint
MaxAmount string Yes Yes Maximum number of ECS instances that can be created at a time. Value range: [1, 100]. The value of MaxAmount must be greater than or equal to that of MinAmount.
MinAmount string Yes Yes Minimum number of ECS instances that must be created at a time. Value range: [1, 100]. The value of MinAmount must be smaller than or equal to that of MaxAmount.
Description string No No Description. The maximum length is 256 characters.
InstanceType string Yes No ECS instance type. Instance generations and type families.
ImageId string Yes Yes ID of the image used to start the ECS instances. The image can be a public image, custom image, or a marketplace image. ECS public image list.

You can specify a public image ID in a fuzzy manner. Generally, to deploy an ECS instance, specify the image type and version or specify only the image type when editing a template. ROS automatically selects a proper public image ID. And when you specify an image ID, 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:

ubuntu14_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 instances, you can

Specify: ubuntu

Match: ubuntu_16_0402_64_20G_alibase_20170818.vhd

Specify: ubuntu_14

Match: ubuntu_14_0405_64_20G_alibase_20170824.vhd

Specify: ubuntu1432

Match: ubuntu_14_0405_32_40G_alibase_20170711.vhd

Specify: ubuntu_16_0402_32

Match: ubuntu_16_0402_32_40G_alibase_20170711.vhd

SecurityGroupId string Yes No ID of the security group to which the created instance belongs. N/A
InstanceName string No No Instance name. The instance name can contain a maximum of 128 characters including letters, numbers, periods(.), hyphens(-), and underscores().
Password string No No ECS instance logon password. The password is a string of 8-30 characters and must contain uppercase or lowercase letters, numbers, and special characters including ( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ‘ < > , . ? /. If the Password parameter is input, HTTPS method must be used when calling the APIs to prevent 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. A host name cannot start or end with a period(.) or a hyphen(-). In addition, consecutive periods(.) or hyphens(-) are not allowed. In Windows, a host name can contain a maximum of 15 characters including uppercase or lowercase letters, numbers, and hyphens(-). It cannot contain only periods (.), or numbers. In other systems 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 or lowercase letters, numbers, and underscores(_).
AllocatePublicIP boolean No No Whether to create public IP addresses. This parameter is only valid for the Classic network type. No public IP addresses are assigned if InternetMaxBandwidthOut is set to 0. The default value is “true”.
AutoReleaseTime string No No Automatic ECS instance release time. The time format follows the ISO8601 standard, for example, “yyyy-MM-ddTHH:mm:ssZ”. The maximum release time is three years.
PrivateIpAddress string No No Internal IP address in VPC. The IP address cannot be the same as the IP addresses of other instances in VPC. N/A
DiskMappings list No No Data disks created for the ECS instances. N/A
InternetChargeType string No No Bandwidth billing method for access over the Internet. Default value: PayByTraffic. Value options: PayByBandwidth and PayByTraffic. Default value: 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 The 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. N/A
SystemDiskDiskName string No No System disk name. N/A
SystemDiskSize string No Yes 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 should be no more than 16 KB and does not need Base64. Use "\" as escape characters for special characters.
ZoneId string No No Zone ID. N/A
VpcId string No No VPC ID. N/A
VSwitchId string No No VSwitch ID. N/A
Networktype string No No Network type of the ECS instances. Value options: VPC and Classic.
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 is set to the instance. However, the password logon mode in Linux is disabled. N/A
RamRoleName string No No The RAM role name of the ECS instance. You can query the role name by calling the ListRoles API. For more information, see CreateRole and ListRoles.
SpotPriceLimit string No No Set the highest hourly price of the ECS instance. Three decimal places are supported at most. This parameter takes effect when the value of SpotStrategy is SpotWithPriceLimit.
SpotStrategy string No No Set your expected spot price for Pay-As-You-Go instances. This parameter takes effect when the value of InstanceChargeType is PostPaid. Valid values:

NoSpot: Bid as a normal Pay-As-You-Go instance.

SpotWithPriceLimit: Set a bidding price threshold for the spot instance.

SpotAsPriceGo: Set a highest Pay-As-You-Go price by the bidding system automatically.

Default value: NoSpot.

DiskMappings syntax

"DiskMappings":[
  {
    "Category":String,
    "DiskName":String,
    "Description":String,
    "Device":String,
    "SnapshotId":String,
    "Size":String
  }
]

DiskMappings attributes

Attribute name Type Required or not Update allowed Description Constraint
Size string Yes No Data disk size, in GB. N/A
Category string No No Data disk type. Value options: cloud, cloud_efficiency, cloud_ssd, and ephemeral_ssdDefault.
DiskName string No No Data disk name. The data disk name can contain a maximum of 128 characters including letters, numbers, periods(.), hyphens(-), and underscores(_).
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. N/A

Tags syntax

"Tags": [
  {
    "Value" : String,
    "Key" : String
  }
]

Tags attributes

Property Type Required Update allowed Error message Constraint
Key String Yes No N/A NA
Value String No No N/A NA

Return values

Fn::GetAtt

  • InstanceIds: IDs of the instances generated by the system and are globally unique. It is a unique identifier of the instance.
  • PrivateIps: list of the private IP addresses of VPC type instances. This parameter is effective when NetworkType is VPC. It is a JSON array of [“172.16.1.1”, “172.16.2.1”, … “172.16.10.1”]. It can contain a maximum of 100 IP addresses, which are separated by commas(,).
  • InnerIps: list of the private IP addresses of Classic type instances. This parameter is effective when NetworkType is Classic. It is a JSON array of [“10.1.1.1”, “10.1.2.1”, … “10.1.10.1”]. It can contain a maximum of 100 IP addresses, which are separated by commas(,).
  • PublicIps: list of the public IP addresses of Classic type instances. This parameter is effective when NetworkType is Classic. It is a JSON array of [“42.1.1.1”, “42.1.2.1”, … “42.1.10.1”]. It can contain a maximum of 100 IP addresses, which are separated by commas(,).
  • ZoneId: zone ID.
  • HostName: Host name of the instance. A Json array with format: ["host1", "host2",... "Host3"].

Example

{
  "ROSTemplateFormatVersion":"2015-09-01",
  "Resources":{
    "WebServer": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "ImageId":"m-25l0rcfjo",
        "InstanceType": "ecs.t1.small",
        "SecurityGroupId": "sg-25zwc3se0",
        "ZoneId": "cn-beijing-b",
		"MaxAmount":1,
		"MinAmount":1,
        "Tags": [{
            "Key": "tiantt",
            "Value": "ros"
        },{
            "Key": "tiantt1",
            "Value": "ros1"
        }
        ]
      }
    }
  },
  "Outputs": {
    "InstanceIds": {
         "Value":{"get_attr": ["WebServer","InstanceIds"]}
    },
    "PublicIps": {
         "Value":{"get_attr": ["WebServer","PublicIps"]}
    }
  }
}