ALIYUN::ECS::InstanceGroup is used to create an ECS instance group.

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,
    "MinAmount":Integer,
    "AllocatePublicIP":Boolean,
    "AutoReleaseTime":String,
    "DiskMappings":List,
    "NetworkType":String,
    "PrivateIpAddress":String,
    "SystemDiskCategory":String,
    "SystemDiskDescription":String,
    "SystemDiskDiskName":String,
    "SystemDiskSize":Number,
    "Tags":List,
    "UserData":String,
    "KeyPairName": String,
    "RamRoleName": String,
    "SpotPriceLimit": String,
    "SpotStrategy": String,
    "DeletionProtection": Boolean
  }
}

Properties

Name Type Required Editable Description Validity
MaxAmount Integer Yes Yes The maximum number of ECS instances to be created. Valid values: 1 to 100. The MaxAmount parameter must be set to a value greater than or equal to the value of MinAmount.
MinAmount String Yes Yes The minimum number of ECS instances to be created. Valid values: 1 to 100. The MinAmount parameter must be set to a value less than or equal to the value of MaxAmount.
Description String No No The description of an ECS instance. The description must be 1 to 256 characters in length.
InstanceType String Yes No The type of an ECS instance. For more information, see ECS instance types.
ImageId String Yes Yes The ID of the image used to start an ECS instance. You can use public images, custom images, and Alibaba Cloud Marketplace images. For more information, see Public images for ECS instances. You can specify part of a public image, without having to provide the complete information. When editing a template used to deploy an ECS instance, you can specify the image type and version or only the image type. ROS automatically selects an appropriate public image ID. You can use the wildcard character (*) to represent part of an image ID.

Take all Ubuntu public images provided by Alibaba Cloud as an example:

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

You can use one of the following methods to specify the public image ID for the ECS instance:

If you enter ubuntu,

the system matches it with the following ID: ubuntu16_0402_64_20G_alibase_20170818.vhd

If you enter ubuntu_14,

the system matches it with the following ID: ubuntu_14_0405_64_20G_alibase_20170824.vhd

If you enter ubuntu1432,

the system matches it with the following ID: ubuntu_14_0405_32_40G_alibase_20170711.vhd

If you enter ubuntu_16_0402_32,

the system matches it with the following ID: ubuntu_16_0402_32_40G_alibase_20170711.vhd
SecurityGroupId String No No The ID of the security group to which a created instance belongs. None
InstanceName String No No The name of an instance. The name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-). Specify the instance names in the format of name_prefix[begin_number,bits]name_suffix.

The name_prefix parameter is required. This parameter specifies the prefix of the name for each instance. The [begin_number,bits] parameter specifies the part of an instance name that distinguishes the name from others. The begin_number parameter specifies the number to start from when you create an instance group. The bits parameter specifies the number of digits for each number in the instance name. The name_suffix parameter specifies the suffix of the name for each instance. This parameter is optional. When you specify the [begin_number,bits] parameter, you must pay attention to the following rules:

Make sure that the parameter contains no spaces.

The value of bits ranges from 1 to 4.

The value of begin_number ranges from 0 to 9,999.

If you specify the begin_number parameter without specifying the bits parameter, the value of bits is set to 4 by default.

If neither the begin_number parameter nor the bits parameter is specified, the value of begin_number is set to 0 and the value of bits is set to 4 by default.

If the number of digits for begin_number is greater than the specified value of bits, the specified value of bits is overridden by the actual number of digits for begin_number. For example, if [begin_number,bits] is set to [1234,1], the bits value of 1 is overridden by the actual number of digits of 1234, which is 4.

Password String No No The password used to log on to an ECS instance. The password must be 8 to 30 characters in length. It must contain letters, digits, and special characters. The following special characters are allowed: parentheses (()), apostrophes ('), tildes (~), exclamation points (!), at signs (@), number signs (#), dollar signs ($), percent signs (%), caret signs (^), ampersands (&), asterisks (*), minus signs (-), plus signs (+), equal signs (=), vertical bars (|), braces ({ }), brackets ([ ]), colons (:), semicolons (;), angle brackets (< >), commas (,), periods (.), question marks (?), and forward slashes (/). If you specify the Password parameter in the API request, use HTTPS to secure the API and protect your password.
HostName String No No The hostname of an ECS instance.

The hostname must be at least 2 characters in length. It cannot start or end with a period (.) or a hyphen (-), nor can it contain consecutive periods (.) or hyphens (-).

For Windows-based instances, the hostname can be up to 15 characters in length and can contain letters, digits, and hyphens (-). It cannot contain periods (.) and cannot be composed of only digits.

For Linux-based instances, the hostname must be 2 to 30 characters in length and can contain letters, digits, hyphens (-), and periods (.). You can use periods (.) to separate a name into multiple segments.

Specify the hostnames for a group of ECS instances in the format of name_prefix[begin_number,bits]name_suffix.

The name_prefix parameter is required. This parameter specifies the prefix of each hostname.

The [begin_number,bits] parameter specifies the part of a hostname that distinguishes the hostname from others. The begin_number parameter specifies the number to start from when you create a group of hostnames. The bits parameter specifies the number of digits for each number in the hostname.

The name_suffix parameter specifies the suffix of each hostname. This parameter is optional.

When you specify the [begin_number,bits] parameter, you must pay attention to the following rules:

Make sure that the parameter contains no spaces.

The value of bits ranges from 1 to 4.

The value of begin_number ranges from 0 to 9,999.

If you specify the begin_number parameter without specifying the bits parameter, the value of bits is set to 4 by default.

If neither the begin_number parameter nor the bits parameter is specified, the value of begin_number is set to 0 and the value of bits is set to 4 by default.

If the number of digits for begin_number is greater than the specified value of bits, the specified value of bits is overridden by the actual number of digits for begin_number. For example, if [begin_number,bits] is set to [1234,1], the bits value of 1 is overridden by the actual number of digits of 1234, which is 4.

AllocatePublicIP Boolean No No Indicates whether the system assigns a public IP address to an instance. If the InternetMaxBandwidthOut parameter is set to 0, no public IP addresses are assigned. Default value: true.
AutoReleaseTime String No No The time scheduled for an ECS instance to be automatically released. The time format is yyyy-MM-ddTHH:mm:ssZ, which must comply with the ISO8601 standard. The specified release time must be within three years from the current time.
PrivateIpAddress String No No The private IP address of an instance in a VPC. The specified IP address must not be used by other instances in the VPC. None
DiskMappings List No No The data disks to be attached to an ECS instance. None
InternetChargeType String No No The billing method for access over the Internet.

Valid values: PayByBandwidth and PayByTraffic.

Default value: PayByTraffic.

InternetMaxBandwidthIn Integer No No The maximum inbound bandwidth from the Internet. Unit: Mbit/s. Valid values: 1 to 100. Default value: 100.
InternetMaxBandwidthOut Integer No No The maximum outbound bandwidth to the Internet. Unit: Mbit/s. Valid values in PayByBandwidth mode: 0 to 200. Default value: 0. Valid values in PayByTraffic mode: 1 to 200. You must specify this parameter if you choose to use the PayByTraffic mode.
IoOptimized String No No Indicates whether to create an I/O optimized instance.

Valid values: none (non-I/O optimized) and optimized (I/O optimized).

Default value: none.

DiskMappings List No No The list of disks to be attached to an ECS instance. A maximum of four disks can be attached.
SystemDiskCategory String No No The type of a system disk. Valid values: cloud, cloud_efficiency, cloud_ssd, and ephemeral_ssd.
SystemDiskDescription String No No The description of the system disk. None
SystemDiskDiskName String No No The name of the system disk. None
SystemDiskSize Number No Yes The size of the system disk. Valid values: 40 to 500. Unit: 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 The custom tags. A maximum of four tags are supported. The format is [{"Key":"tagKey","Value":"tagValue"},{"Key":"tagKey2","Value":"tagValue2"}].
UserData String No No The user information you provide when you create an ECS instance. The size of the user data is limited to 16 KB. You need to convert the data into Base64-encoded strings. If the data contains special characters, add a backslash (\) immediately before each special character.
ZoneId String No No The ID of the zone where an ECS instance resides. None
VpcId String No No The ID of the VPC to which an ECS instance belongs. None
VSwitchId String No No The ID of the VSwitch for an ECS instance. None
Networktype String No No The network type of an ECS instance. Valid values: VPC and Classic.
KeyPairName String No No The name of the key pair that is used to connect to an ECS instance. For Windows-based instances, this parameter is inapplicable and is empty by default. For Linux-based instances, the Password parameter still takes effect if this parameter is specified. However, logon by password is disabled, and the KeyPairName value is used. None
RamRoleName String No No The RAM role name of an instance. You can call the ListRoles API to query the role name. For more information, see CreateRole and ListRoles.
SpotPriceLimit String No No The maximum hourly price of an instance. This parameter is applicable only when SpotStrategy is set to SpotWithPriceLimit. Three decimal places are allowed at most.
SpotStrategy String No No The spot strategy for a Pay-As-You-Go instance. This parameter is applicable only when InstanceChargeType is set to PostPaid.

Valid values:

NoSpot: indicates a regular Pay-As-You-Go instance.

SpotWithPriceLimit: indicates a Pay-As-You-Go instance with the maximum hourly price.

SpotAsPriceGo: indicates that the system automatically offers a spot hourly price for an instance based on the supply-demand statistics. The spot price is limited to the cost of resources you actually use.

Default value: NoSpot.

DedicatedHostId String No No The ID of the dedicated host (DDH) for an instance. None
LaunchTemplateName String No No The name of the launch template for an instance. None
PeriodUnit String No No The unit of the billing cycle.

When the PeriodUnit parameter is set to Week:

  • Valid values for the Period parameter: 1, 2, 3, and 4.
  • Valid values for the AutoRenewPeriod parameter: 1, 2, and 3.
When the PeriodUnit parameter is set to Month:
  • Valid values for the Period parameter: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.
  • Valid values for the AutoRenewPeriod parameter: 1, 2, 3, 6, and 12.

Valid values: Week and Month.

Default value: Month.

AutoRenewPeriod Number No Yes The period your subscription is automatically extended by after an instance expires. This parameter is required when AutoRenew is set to True.

Valid values: 1, 2, 3, 6, and 12.

Default value: 1.

AutoRenew String No Yes Indicates whether automatic renewal is enabled for an instance. This parameter is applicable only when InstanceChargeType is set to PrePaid. Valid values:
  • True: indicates that automatic renewal is enabled for an instance.
  • False: indicates that automatic renewal is disabled for an instance. This is the default value.
InstanceChargeType String No Yes The billing method of an instance. Valid values:
  • PrePaid: indicates the subscription billing method. In this case, the service is billed on a monthly or yearly basis. You must ensure that the balance of your account or credit balance can cover the cost of the subscription. Otherwise, you will receive an InvalidPayMethod error code.
  • PostPaid: indicates the Pay-As-You-Go billing method. In this case, the service is billed by the amount of resources that you actually use. This is the default value.
EniMappings List No Yes The elastic network interfaces (ENIs) attached to instances. Only one ENI can be attached to an instance.
LaunchTemplateId String No Yes The ID of the launch template for an instance. None
LaunchTemplateVersion String No Yes The version of the launch template. If you do not specify a version, the default version is used. None
Period Number No Yes The subscription period of an instance. Unit: month. This parameter is required only when InstanceChargeType is set to PrePaid. When the DedicatedHostId parameter is specified, the subscription period of the instance must be shorter than that of the DDH. Valid values:
  • Valid values for the Period parameter in the case of PeriodUnit=Week: 1, 2, 3, and 4.
  • Valid values for the Period parameter in the case of PeriodUnit=Month: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.
NetworkType String No No The network type of an ECS instance.

Valid values: VPC and Classic.

Default value: Classic.

DeletionProtection Boolean No No The release protection property of an instance. It indicates whether you can use the ECS console or call the DeleteInstance operation to release the instance. Valid values: true and false.

DiskMappings syntax

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

DiskMappings properties

Name Type Required Editable Description Validity
Size String Yes No The size of a data disk. Unit: GB. None
Category String No No The type of the data disk. Valid values: cloud, cloud_efficiency, cloud_ssd, and ephemeral_ssd.
DiskName String No No The name of the data disk. The name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
Description String No No The description of the data disk. The description must be 2 to 256 characters in length. This parameter is empty by default.
Device String No No The device name of the data disk to be attached to an ECS instance. For example, /dev/xvd[a-z].
SnapshotId String No No The ID of the snapshot used to create the data disk. None

Tags syntax

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

Tags properties

Name Type Required Editable Description Validity
Key String Yes No None None
Value String No No None None

Response parameters

Fn::GetAtt

  • InstanceIds: the IDs of instances in an ECS instance group. An ID is a system-generated globally unique identifier (GUID) for each instance.
  • PrivateIps: the list of private IP addresses of instances in a VPC. This parameter is applicable only when the NetworkType parameter is set to VPC. The list is a JSON array, containing up to 100 IP addresses that are separated by commas (,). For example, ["172.16.XX.XX", "172.16. XX.XX", … "172.16. XX.XX"].
  • InnerIps: the list of private IP addresses of instances in a classic network. This parameter is applicable only when the NetworkType parameter is set to Classic. The list is a JSON array, containing up to 100 IP addresses that are separated by commas (,). For example, ["10.1.XX.XX", "10.1. XX.XX", … "10.1. XX.XX"].
  • PublicIps: the list of public IP addresses of instances in a classic network. This parameter is applicable only when the NetworkType parameter is set is Classic. The list is a JSON array, containing up to 100 IP addresses that are separated by commas (,). For example, ["42.1.XX.XX", "42.1. XX.XX", … "42.1. XX.XX"].
  • ZoneId: the ID of the zone where an instance resides.
  • HostNames: the list of hostnames of all instances. The list is a formatted JSON array. For example, ["host1", "host2", … "host3"].

Examples

{
  "ROSTemplateFormatVersion":"2015-09-01",
  "Resources":{
    "WebServer": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "ImageId":"m-25l0r****",
        "InstanceType": "ecs.t1.small",
        "SecurityGroupId": "sg-25zwc****",
        "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"]}
    }
  }
}