You can use ALIYUN::ECS::InstanceGroup to batch create ECS instances.

Specifically, use the InstanceName and HostName properties to define instance names and hostnames. The instance names and hostnames must use the following syntax: name_prefix[begin_number,bits]name_suffix.

An instance name or hostname consists of three parts:

  • name_pefix (required): prefix of the instance name or hostname. [DO NOT TRANSLATE]
  • [begin_number,bits] (required): the part that changes for each name. begin_number indicates the starting number of the instance names or hostnames. bits indicates the number of digits of each number.

    This part must meet the following requirements to be correctly parsed:

    • begin_number and bits are separated by a comma only, and have no space characters.
    • The value of bits ranges from 1 to 4.
    • The value of begin_number ranges from 0 to 9999.

    How do we determine the value of bits

    • If you only define a value for begin_number, then bits defaults to 4.
    • If you do not define a value for begin_number or bits, then begin_number starts with 0, and bits defaults to 4.
    • If the defined value of begin_number has more digits than that defined in bits, then the larger digit number takes effect. Take [1234,1] for example. begin_number is 1234 which is a 4-digit number, while digits is 1. Since 1234 is within the valid value range of 0-9999, digits is in fact 4.
  • name_suffix (optional): suffix of the instance name or hostname.


  "ROSTemplateFormatVersion" : "2015-09-01",
  "Resources" : {
    "WebServer": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "ImageId": "CentOs*",
        "InstanceType": "ecs.n4.large",
        "Password": "Test1234",
        "MinAmount": 2,
        "MaxAmount": 2,
        "SecurityGroupId": "sg-2zedcm7ep5quses05fs4",
        "SystemDiskCategory": "cloud_efficiency",
        "IoOptimized": "optimized",
        "InstanceName": "my. test-[1114]",
        "HostName": "host []"

The preceding template dictates that Resource Orchestration Service (ROS) creates two ECS instances in batch.

  • The instance names of the two instances are my.test-1114 and my.test-1115, respectively.
  • The hostnames of the two instances are host0000 and host0001, respectively.
Notice The instance names and hostnames must meet the preceding requirements in order to be parsed correctly. Otherwise, the template fails to validate.