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 in a single scaling operation. 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 in a single scaling operation. 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 created ECS instances. The description can be up to 256 characters in length.
InstanceType String Yes No The instance type of created ECS instances. 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 a public image, custom image, or Alibaba Cloud Marketplace image. For more information, see Public images for ECS instances. You can partially specify a public image without providing its 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 the 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 an 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 created instances will belong. None
InstanceName String No No The name of created instances. The name can be up to 128 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-). Instance names must be in the name_prefix[begin_number,bits]name_suffix format.

The name_prefix parameter is required. This parameter specifies the prefix of each instance name. The [begin_number,bits] parameter specifies the part of an instance name that distinguishes a created instance from others. The begin_number parameter specifies the number to start from when instances are created in the group. The bits parameter specifies the number of digits for each number in the instance name. The name_suffix parameter specifies the suffix of each instance name. 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 can range from 1 to 4.

The value of begin_number can range from 0 to 9999.

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 number of digits in the specified value of begin_number. For example, if [begin_number,bits] is set to [1234,1], the bits value will be overridden by the number of digits in the specified value of begin_number, which is 4.

Password String No No The password used to log on to created ECS instances. The password must be 8 to 30 characters in length. It must contain letters, digits, and special characters. The following special characters are allowed: ( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ' < > , . ? / 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 created ECS instances.

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.

Hostnames for created ECS instances must be in the name_prefix[begin_number,bits]name_suffix format.

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 a created instance from others. The begin_number parameter specifies the number to start from when instances are created in the group. 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 can range from 1 to 4.

The value of begin_number can range from 0 to 9999.

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 number of digits in the specified value of begin_number. For example, if [begin_number,bits] is set to [1234,1], the bits value will be overridden by the number of digits in the specified value of begin_number, which is 4.

AllocatePublicIP Boolean No No Specifies whether the system allocates a public IP address to an instance. If the InternetMaxBandwidthOut parameter is set to 0, no public IP addresses will be allocated. Default value: true
AutoReleaseTime String No No The time scheduled for an ECS instance to be automatically released. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. 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 created ECS instances. 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 Specifies whether created instances are I/O optimized.

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

Default value: none

SystemDiskCategory String No No The system disk type of created instances. Valid values: cloud, cloud_efficiency, cloud_ssd, and ephemeral_ssd
SystemDiskDescription String No No The system disk description of created instances. None
SystemDiskDiskName String No No The system disk name of created instances. None
SystemDiskSize Number No Yes The system disk size of created instances. 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 of the ECS instance group. A maximum of four tags can be specified. 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 user information can be up to 16 KB in size. You must 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 created ECS instances reside. None
VpcId String No No The ID of the VPC to which created instances will belong. None
VSwitchId String No No The ID of the VSwitch for created ECS instances. None
KeyPairName String No No The name of the key pair used to connect to ECS instances. 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 name of the RAM role assigned to created instances. 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 created instances. This parameter is only valid when SpotStrategy is set to SpotWithPriceLimit. A maximum of three decimal places can be specified.
SpotStrategy String No No The spot strategy for pay-as-you-go instances. This parameter is only valid when InstanceChargeType is set to PostPaid.

Valid values:

NoSpot: specifies a regular pay-as-you-go instance.

SpotWithPriceLimit: specifies a pay-as-you-go instance with the maximum hourly price.

SpotAsPriceGo: specifies a pay-as-you-go instance priced at the market price at the time of purchase.

Default value: NoSpot

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

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 automatic subscription renewal period for expired instances. 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 Specifies whether to enable automatic renewal for created instances. Default value: False. This parameter is only valid when InstanceChargeType is set to PrePaid. Valid values:
  • True: specifies to enable automatic renewal for created instances.
  • False: specifies to disable automatic renewal for created instances.
InstanceChargeType String No Yes The billing method of created instances. Default value: PostPaid. Valid values:
  • PrePaid: specifies 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: specifies the pay-as-you-go billing method. In this case, the service is billed by the amount of resources that you actually use.
EniMappings List No Yes The elastic network interfaces (ENIs) to be attached to created instances. Only one ENI can be attached to an instance.
LaunchTemplateId String No Yes The ID of the launch template from which to create instances. None
LaunchTemplateVersion String No Yes The version of the specified launch template. If you do not specify a version, the default version is used. None
Period Number No Yes The subscription period of created instances. Unit: month. This parameter is required only when InstanceChargeType is set to PrePaid. If the DedicatedHostId parameter is specified, the subscription period of the instances 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 created ECS instances.

Valid values: VPC and Classic

Default value: Classic

DeletionProtection Boolean No No The release protection property of created ECS instances. It specifies whether the ECS console or the DeleteInstance API can be used to release the instances. Valid values: true and false

DiskMappings syntax

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

DiskMappings properties

Name Type Required Editable Description Validity
Size String Yes No The data disk size of created instances. Unit: GB. None
Category String No No The data disk type of created instances. Valid values: cloud, cloud_efficiency, cloud_ssd, and ephemeral_ssd
DiskName String No No The data disk name of created instances. The name can be up to 128 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
Description String No No The data disk description of created instances. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
Device String No No The device name of data disks to be attached to created ECS instances. For example, /dev/xvd[a-z].
SnapshotId String No No The ID of the snapshot used to create data disks. None
Encrypted String No No Specifies whether to encrypt the data disks. Default value: false
KMSKeyId String No No The ID of the KMS key corresponding to created data disks. 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 the 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 only valid 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 (,). 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 only valid 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 (,). 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 only valid 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 (,). Example: ["42.1.XX.XX", "42.1. XX.XX", ... "42.1. XX.XX"].
  • ZoneId: the ID of the zone where created instances reside.
  • 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"]}
    }
  }
}