All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::InstanceGroup

Last Updated:Jul 29, 2024

ALIYUN::ECS::InstanceGroup is used to create Elastic Compute Service (ECS) instances that have the same configurations.

Syntax

{
  "Type": "ALIYUN::ECS::InstanceGroup",
  "Properties": {
    "DedicatedHostId": String,
    "ResourceGroupId": String,
    "SystemDiskDescription": String,
    "InstanceChargeType": String,
    "RamRoleName": String,
    "SystemDiskPerformanceLevel": String,
    "ImageId": String,
    "SystemDiskDiskName": String,
    "Tags": List,
    "HostName": String,
    "LaunchTemplateName": String,
    "VSwitchId": String,
    "Period": Number,
    "ZoneIds": List,
    "LaunchTemplateId": String,
    "DeletionProtection": Boolean,
    "SecurityGroupIds": List,
    "SecurityEnhancementStrategy": String,
    "InternetChargeType": String,
    "InstanceName": String,
    "DeploymentSetId": String,
    "InternetMaxBandwidthOut": Integer,
    "VpcId": String,
    "LaunchTemplateVersion": String,
    "PeriodUnit": String,
    "AutoReleaseTime": String,
    "PrivateIpAddress": String,
    "Description": String,
    "DiskMappings": List,
    "SystemDiskSize": Number,
    "UserData": String,
    "AutoRenew": String,
    "Ipv6Addresses": List,
    "MaxAmount": Integer,
    "SystemDiskAutoSnapshotPolicyId": String,
    "Ipv6AddressCount": Integer,
    "NetworkType": String,
    "SpotPriceLimit": String,
    "InstanceType": String,
    "AllocatePublicIP": Boolean,
    "SpotStrategy": String,
    "Password": String,
    "PasswordInherit": Boolean,
    "AutoRenewPeriod": Number,
    "KeyPairName": String,
    "IoOptimized": String,
    "ZoneId": String,
    "HpcClusterId": String,
    "SecurityGroupId": String,
    "SystemDiskCategory": String,
    "EniMappings": List,
    "SystemDiskProvisionedIops": Integer,
    "SystemDiskBurstingEnabled": Boolean,
    "SpotInterruptionBehavior": String,
    "SpotDuration": Integer,
    "UpdatePolicy": String,
    "SystemDiskEncrypted": String,
    "SystemDiskEncryptAlgorithm": String,
    "SystemDiskStorageClusterId": String,
    "SystemDiskKMSKeyId": String,
    "CreditSpecification": String,
    "PrivatePoolOptions": Map,
    "StorageSetId": String,
    "HttpTokens": String,
    "HttpEndpoint": String,
    "Tenancy": String,
    "StorageSetPartitionNumber": Integer,
    "DeploymentSetGroupNo": Integer,
    "Affinity": String,
    "UseAdditionalService": Boolean,
    "ImageFamily": String,
    "DeletionForce": Boolean,
    "UniqueSuffix": Boolean,
    "NetworkOptions": Map,
    "CpuOptions": Map,
    "NetworkInterfaceQueueNumber": Integer,
    "HostNames": List,
    "ImageOptions": Map,
    "SecurityOptions": Map,
    "SchedulerOptions": Map
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

ResourceGroupId

String

No

Yes

The ID of the resource group to which the ECS instances belong.

None.

SpotInterruptionBehavior

String

No

No

The interruption mode of the preemptible instances.

Set the value to Terminate. A value of Terminate specifies that the system directly releases preemptible instances. Default value: Terminate.

SpotDuration

Integer

No

No

The protection period of the preemptible instances.

Valid values: 0 to 6.

Unit: hour.

Valid values:

  • 0: If you set this property to 0, preemptible instances do not have a protection period.

  • 2 to 6: These protection periods are in invitational preview. If you want to set this property to one of the values, submit a ticket.

  • 1 (default).

HpcClusterId

String

No

Yes

The ID of the Elastic High Performance Computing (E-HPC) cluster to which the ECS instances belong.

Updates to this property take effect only for new ECS instances.

MaxAmount

Integer

Yes

Yes

The number of ECS instances that you can create at a time.

Valid values: 1 to 1000.

Note

If you increase or decrease the value of MaxAmount when you update the stack that references the property, the number of ECS instances is increased or decreased based on the new value. For example, if you change the value of MaxAmount from 2 to 5, three ECS instances are added.

Description

String

No

Yes

The description.

The description can be up to 256 characters in length.

Note

Updates to this property take effect only for new ECS instances.

InstanceType

String

Yes

Yes

The ECS instance type.

For more information, see Overview of instance families.

Note

You can update this property when UpdatePolicy is set to ForAllInstances.

ImageId

String

No

Yes

The ID of the image that is used to start the ECS instances. You can use a public image, a custom image, or an Alibaba Cloud Marketplace image.

To specify a public image, you can enter a partial image ID. Public images support fuzzy search. Examples:

  • If you specify Ubuntu, the system matches it with the following ID: ubuntu_16_0402_64_20G_alibase_20170818.vhd.

  • If you specify Ubuntu1432, the system matches it with the following ID: ubuntu_14_0405_32_40G_alibase_20170711.vhd.

For more information, see Request parameters.

SecurityGroupId

String

No

No

The ID of the security group to which the ECS instances belong. Instances in the same security group can communicate with each other.

You cannot specify both SecurityGroupId and SecurityGroupIds.

SecurityGroupIds

List

No

No

The IDs of the security groups to which the ECS instances belong.

You cannot specify both SecurityGroupId and SecurityGroupIds.

For more information, see Security group limits.

SecurityEnhancementStrategy

String

No

No

Specifies whether to enable security hardening.

Valid values:

  • Active: enables security hardening. This value is valid only for public images.

  • Deactive: disables security hardening. This value is valid for all types of images.

InstanceName

String

No

No

The name of the ECS instance.

The name can be up to 128 characters in length, and can contain letters, digits, underscores (_), periods (.), and hyphens (-).

The name must be in the name_prefix[begin_number,bits]name_suffix format. The name of each ECS instance must be unique. For more information, see Request parameters.

Password

String

No

Yes

The password that you want to use to log on to the ECS instance.

The password must be 8 to 30 characters in length, and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The following special characters are supported: : ( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ‘ < > , . ? /.

If you specify Password, we recommend that you call the Resource Orchestration Service (ROS) API by using HTTPS to prevent the exposure of your password.

PasswordInherit

Boolean

No

No

Specifies whether to use the preset password of the image.

Valid values:

  • true

  • false

Note

If you set this property to true, you must leave Password empty and make sure that the selected image has a preset password.

ZoneIds

List

No

No

The zones.

None.

HostName

String

No

No

The hostname.

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

For more information, see Request parameters.

AllocatePublicIP

Boolean

No

No

Specifies whether to assign a public IP address.

If you set InternetMaxBandwidthOut to 0, the system does not assign a public IP address.

Valid values:

  • true (default)

  • false

AutoReleaseTime

String

No

No

The time at which the system automatically releases the ECS instances.

Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be within three years from the time at which the ECS instances are created.

PrivateIpAddress

String

No

No

The private IP address of the ECS instance.

If you specify a private IP address for an ECS instance in a virtual private cloud (VPC), you must select an idle IP address from the CIDR block of the vSwitch.

Note

If you specify PrivateIpAddress, you must set MaxAmount to 1.

DiskMappings

List

No

Yes

The data disks that you want to create for the ECS instance.

You can create up to 16 data disks.

If you change the value of this property, existing ECS instances are not affected. The new value is valid for new ECS instances.

For more information, see DiskMappings properties.

Note

Updates to this property take effect only for new ECS instances.

InternetChargeType

String

No

Yes

The metering method for Internet usage.

Valid values:

  • PayByBandwidth: pay-by-bandwidth

  • PayByTraffic (default): pay-by-data-transfer

Note

You can update this property when UpdatePolicy is set to ForAllInstances.

InternetMaxBandwidthOut

Integer

No

Yes

The maximum outbound public bandwidth.

Valid values: 0 to 100.

Unit: Mbit/s.

Default value: 0.

Note

You can update this property when UpdatePolicy is set to ForAllInstances.

SystemDiskProvisionedIops

Integer

No

Yes

The IOPS that is preconfigured for the system disk.

None.

SystemDiskBurstingEnabled

Boolean

No

Yes

Specifies whether to enable the burst mode for the system disk.

Valid values:

  • true

  • false (default)

IoOptimized

String

No

No

Specifies whether to create I/O optimized instances.

Valid values:

  • none: does not create I/O optimized instances.

  • optimized (default): creates I/O optimized instances.

SystemDiskCategory

String

No

Yes

The category of the system disk.

Valid values:

  • cloud: basic disk

  • cloud_efficiency: ultra disk

  • cloud_ssd: standard SSD

  • cloud_essd: Enterprise SSD (ESSD)

  • ephemeral_ssd: local SSD

Note

Updates to this property take effect only for new ECS instances.

SystemDiskDescription

String

No

Yes

The description of the system disk.

Updates to this property take effect only for new ECS instances.

SystemDiskDiskName

String

No

Yes

The name of the system disk.

Updates to this property take effect only for new ECS instances.

SystemDiskSize

Number

No

Yes

The size of the system disk.

Valid values: 40 to 500.

Unit: GB.

If you use a custom image to create a system disk, you must make sure that the size of the system disk is larger than the size of the custom image.

Note

You can update this property when UpdatePolicy is set to ForAllInstances.

Tags

List

No

Yes

The custom tags that you want to add to the ECS instance.

You can specify up to 20 tags in the following format: [{"Key":"tagKey","Value":"tagValue"},{"Key":"tagKey2","Value":"tagValue2"}].

For more information, see Tags properties.

UserData

String

No

Yes

The user data that you specify when you create the ECS instances.

The user data can be up to 16 KB in size. You do not need to convert the data into Base64-encoded strings. If the data contains special characters, you must add the escape character (\) before each special character.

ZoneId

String

No

No

The zone ID.

None.

VpcId

String

No

No

The VPC ID.

None.

VSwitchId

String

No

No

The vSwitch ID.

None.

KeyPairName

String

No

Yes

The name of the key pair that you want to use to connect to the ECS instances.

For ECS Windows instances, you can ignore KeyPairName. By default, this property is empty.

If you specify KeyPairName, the value of Password is still used for ECS instances. However, password-based logons are disabled for ECS Linux instances.

Note

Updates to this property take effect only for new ECS instances.

RamRoleName

String

No

Yes

The name of the Resource Access Management (RAM) role that you want to attach to the ECS instances.

You can call the ListRoles operation to query the RAM role name.

SpotPriceLimit

String

No

No

The maximum hourly price of the ECS instances.

The value of this property can contain up to three decimal places. This property takes effect when SpotStrategy is set to SpotWithPriceLimit.

SpotStrategy

String

No

No

The bidding policy for the pay-as-you-go instance.

This property takes effect when InstanceChargeType is set to PostPaid.

Valid values:

  • NoSpot (default): The instance is created as a regular pay-as-you-go instance.

  • SpotWithPriceLimit: The instance is created as a preemptible instance that has a user-defined maximum hourly price.

  • SpotAsPriceGo: The instance is created as a preemptible instance whose bidding price is based on the market price at the time of purchase. The market price can be up to the pay-as-you-go price.

DedicatedHostId

String

No

No

The ID of the dedicated host.

None.

LaunchTemplateName

String

No

Yes

The name of the launch template.

None.

PeriodUnit

String

No

Yes

The unit of the subscription duration.

Valid values:

  • Week

  • Month (default)

Note

Updates to this property take effect only for new ECS instances.

AutoRenewPeriod

Number

No

Yes

The auto-renewal period.

You must specify this property when AutoRenew is set to True.

Valid values:

  • 1 (default)

  • 2

  • 3

  • 6

  • 12

Note

Updates to this property take effect only for new ECS instances.

AutoRenew

String

No

Yes

Specifies whether to enable auto-renewal.

This property takes effect when InstanceChargeType is set to PrePaid.

Valid values:

  • True

  • False (default)

Note

Updates to this property take effect only for new ECS instances.

InstanceChargeType

String

No

Yes

The billing method of the ECS instances.

Valid values:

  • PrePaid: subscription

    Note

    If you set this property to PrePaid, you must make sure that your account has sufficient balance or credit. If your account has insufficient balance or credit, an InvalidPayMethod error is returned.

  • PostPaid (default): pay-as-you-go

Note

Updates to this property take effect only for new ECS instances.

EniMappings

List

No

Yes

The elastic network interfaces (ENIs) that you want to attach to the ECS instances.

You can attach up to one ENI to an instance.

For more information, see EniMappings properties.

LaunchTemplateId

String

No

Yes

The ID of the launch template.

None.

LaunchTemplateVersion

String

No

Yes

The version of the launch template.

If you do not specify a version, the default version is used.

Period

Number

No

Yes

The subscription duration of the ECS instances.

You must specify this property when InstanceChargeType is set to PrePaid.

If you specify DedicatedHostId, the value of Period must be within the subscription period of the dedicated host.

  • Valid values of Period when PeriodUnit is set to Week: 1 to 4.

  • Valid values of Period when PeriodUnit is set to Month: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.

Note

Updates to this property take effect only for new ECS instances.

NetworkType

String

No

No

The network type of the ECS instances.

Valid values:

  • vpc

  • classic (default)

DeletionProtection

Boolean

No

Yes

The deletion protection property of the ECS instances. You can use this property to specify whether you can delete the ECS instances in the ECS console or by calling the DeleteInstance operation.

Valid values:

  • true: You can delete the ECS instances in the ECS console or by calling the DeleteInstance operation.

  • false: You cannot delete the ECS instances in the ECS console or by calling the DeleteInstance operation.

DeploymentSetId

String

No

Yes

The ID of the deployment set.

Updates to this property take effect only for new ECS instances.

Ipv6AddressCount

Integer

No

Yes

The number of IPv6 addresses to generate for the ENI at random.

You cannot specify both Ipv6Addresses and Ipv6AddressCount.

Note

Updates to this property take effect only for new ECS instances.

Ipv6Addresses

List

No

Yes

The IPv6 addresses to assign to the ENI.

You can specify up to one IPv6 address. If you change the value of this property, existing ECS instances are not affected. You cannot specify both Ipv6Addresses and Ipv6AddressCount.

Note

Updates to this property take effect only for new ECS instances.

SystemDiskAutoSnapshotPolicyId

String

No

Yes

The ID of the automatic snapshot policy that you want to use for the system disk.

None.

SystemDiskPerformanceLevel

String

No

Yes

The performance level (PL) of the ESSD that you want to use as the system disk.

Valid values:

  • PL0: An ESSD can deliver up to 10,000 random read/write IOPS.

  • PL1 (default): An ESSD can deliver up to 50,000 random read/write IOPS.

  • PL2: An ESSD can deliver up to 100,000 random read/write IOPS.

  • PL3: An ESSD can deliver up to 1,000,000 random read/write IOPS.

For more information about how to select the PL of the ESSD, see ESSDs.

UpdatePolicy

String

No

Yes

The update policy that you want to use for ECS instances.

Valid values:

  • ForNewInstance (default): The update policy takes effect for new ECS instances.

  • ForAllInstances: The update policy takes effect for all ECS instances.

SystemDiskEncrypted

String

No

Yes

Specifies whether to encrypt the system disk.

Valid values:

  • true

  • false

SystemDiskEncryptAlgorithm

String

No

Yes

The encryption algorithm that you want to use for the system disk.

Valid values:

  • AES-256

  • SM4-128

SystemDiskStorageClusterId

String

No

Yes

The ID of the dedicated block storage cluster in which the system disk resides.

None.

SystemDiskKMSKeyId

String

No

Yes

The ID of the Key Management Service (KMS) key that you want to use for the system disk.

None.

CreditSpecification

String

No

Yes

The performance mode of the burstable instance.

Valid values:

  • Standard: standard mode. For more information, see the "Standard mode" section of the Overview topic.

  • Unlimited: unlimited mode. For more information, see the "Unlimited mode" section of the Overview topic.

PrivatePoolOptions

Map

No

No

The options of the private pool to use to start the ECS instances.

For more information, see PrivatePoolOptions properties.

StorageSetId

String

No

No

The ID of the storage set.

None.

HttpTokens

String

No

Yes

Specifies whether to forcefully use the security hardening mode (IMDSv2) to access the instance metadata.

Valid values:

  • optional (default): does not forcefully use the security hardening mode (IMDSv2) to access the instance metadata.

  • required: forcefully uses the security hardening mode (IMDSv2) to access the instance metadata. After you set this property to required, you cannot access the instance metadata in normal mode.

Note

For more information about the access modes of instance metadata, see Access mode of instance metadata.

HttpEndpoint

String

No

Yes

Specifies whether to enable the access channel for the instance metadata.

Valid values:

  • enabled (default)

  • disabled

Note

For more information about instance metadata, see Overview of ECS instance metadata.

Tenancy

String

No

No

Specifies whether to create an instance on a dedicated host.

Valid values:

  • default (default): does not create an instance on a dedicated host.

  • host: creates an instance on a dedicated host. If you do not specify DedicatedHostId, Alibaba Cloud automatically selects a dedicated host for the instance.

StorageSetPartitionNumber

Integer

No

No

The maximum number of partitions in the storage set.

You must set this property to a value that is greater than or equal to 2.

DeploymentSetGroupNo

Integer

No

No

The group number of the deployment set group to which to deploy the instance. If the deployment set specified by DeploymentSetId uses the high availability group strategy (AvailabilityGroup), you can use DeploymentSetGroupNo to specify a deployment set group in the deployment set.

Valid values: 1 to 7.

Affinity

String

No

No

Specifies whether to associate an instance on a dedicated host with the dedicated host.

Valid values:

  • default: does not associate an instance on a dedicated host with the dedicated host. When you start an instance that was stopped in economical mode and the original dedicated host of the instance has insufficient resources, the instance is deployed to another dedicated host in the automatic deployment resource pool.

  • host: associates an instance on a dedicated host with the dedicated host. When you start an instance that was stopped in economical mode, the instance remains on the original dedicated host. If the original dedicated host of the instance has insufficient resources, the instance fails to be started.

UseAdditionalService

Boolean

No

No

Specifies whether to use the system configurations for virtual machines. Alibaba Cloud provides the Network Time Protocol (NTP) and KMS system configurations for Windows and the NTP and Yellowdog Updater, Modified (YUM) system configurations for Linux.

Valid values:

  • true

  • false

ImageFamily

String

No

No

The name of the image family.

You can specify this property to query the latest available image that belongs to the specified image family and use the image to create an instance.

  • If you specify ImageId, you cannot specify ImageFamily.

  • If you do not specify ImageId but use LaunchTemplateId or LaunchTemplateName to specify a launch template for which ImageId is defined, you cannot specify ImageFamily.

  • If you do not specify ImageId but use LaunchTemplateId or LaunchTemplateName to specify a launch template for which ImageId is not defined, you can specify ImageFamily.

  • If you do not specify ImageId and do not specify LaunchTemplateId or LaunchTemplateName, you can specify ImageFamily.

Note

For more information about the image families that are associated with Alibaba Cloud official images, see Overview.

DeletionForce

Boolean

No

No

Specifies whether to forcefully delete the instance.

Default value: false.  

UniqueSuffix

Boolean

No

No

Specifies whether to automatically append sequential suffixes to the HostName and InstanceName values when you create multiple instances.

The sequential suffixes range from 001 to 999. Valid values:

  • true

  • false (default)

When you specify the HostName or InstanceName value in the name_prefix[begin_number,bits] format that does not contain a suffix specified by name_suffix, UniqueSuffix does not take effect. The names are sorted only in the specified sequence.

For more information, see Batch configure sequential names or hostnames for multiple instances.

NetworkOptions

Map

No

No

The network options.

For more information, see NetworkOptions property.

CpuOptions

Map

No

No

The CPU options.

For more information, see CpuOptions properties.

NetworkInterfaceQueueNumber

Integer

No

No

The number of queues supported by the primary ENI.

Take note of the following items:

  • The value of this property cannot exceed the maximum number of queues per ENI allowed for the instance type.

  • The total number of queues for all ENIs on an instance cannot exceed the queue quota for the instance type. To obtain the maximum number of queues per ENI for an instance type and the queue quota for the instance type, you can call the DescribeInstanceTypes operation and query the MaximumQueueNumberPerEni and TotalEniQueueQuantity values.

  • If NetworkInterface.N.InstanceType is set to Primary, you cannot specify NetworkInterfaceQueueNumber but can specify NetworkInterface.N.QueueNumber.

HostNames

List

No

No

The hostnames that you want to use for multiple instances.

None.

ImageOptions

Map

No

No

The image options.

For more information, see ImageOptions property.

SecurityOptions

Map

No

No

The trusted system options.

For more information, see SecurityOptions property.

SchedulerOptions

Map

No

No

The scheduling options.

For more information, see SchedulerOptions properties.

DiskMappings syntax

"DiskMappings": [
  {
    "Category": String,
    "DiskName": String,
    "Description": String,
    "Device": String,
    "SnapshotId": String,
    "Size": String,
    "Encrypted": String,
    "KMSKeyId": String,
    "PerformanceLevel": String,
    "AutoSnapshotPolicyId": String,
    "ProvisionedIops": Integer,
    "BurstingEnabled": Boolean,
    "StorageClusterId": String
  }
]

DiskMappings properties

Property

Type

Required

Editable

Description

Constraint

Size

String

Yes

No

The size of the data disk.

Unit: GB.

Category

String

No

No

The category of the data disk.

Valid values:

  • cloud: basic disk

  • cloud_efficiency: ultra disk

  • cloud_ssd: standard SSD

  • cloud_essd: ESSD

  • ephemeral_ssd: local SSD

The default value for an I/O optimized instance is cloud_efficiency.

The default value for a non-I/O optimized instance is cloud.

DiskName

String

No

No

The name of the data disk.

The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, underscores (_), colons (:), and hyphens (-).

Description

String

No

No

The description of the data disk.

The description must be 2 to 256 characters in length. It cannot start with http:// or https://.

Device

String

No

No

The mount target.

Note

This property will be removed in the future. To improve compatibility, we recommend that you use other properties.

SnapshotId

String

No

No

The snapshot ID.

None.

Encrypted

String

No

No

Specifies whether to encrypt the data disk.

Valid values:

  • true

  • false (default)

KMSKeyId

String

No

No

The ID of the KMS key that you want to use for the data disk.

None.

AutoSnapshotPolicyId

String

No

No

The ID of the automatic snapshot policy.

None.

PerformanceLevel

String

No

No

The PL of the ESSD that you want to use as the data disk.

Valid values:

  • PL0: An ESSD can deliver up to 10,000 random read/write IOPS.

  • PL1 (default): An ESSD can deliver up to 50,000 random read/write IOPS.

  • PL2: An ESSD can deliver up to 100,000 random read/write IOPS.

  • PL3: An ESSD can deliver up to 1,000,000 random read/write IOPS.

For more information about how to select the PL of the ESSD, see ESSDs.

ProvisionedIops

Integer

No

No

The IOPS that is preconfigured for the data disk.

None.

BurstingEnabled

Boolean

No

No

Specifies whether to enable the burst mode.

Valid values:

  • true

  • false (default)

StorageClusterId

String

No

No

The ID of the dedicated block storage cluster.

None.

Tags syntax

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

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The tag value.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

EniMappings syntax

"EniMappings": [
  {
    "SecurityGroupId": String,
    "VSwitchId": String,
    "Description": String,
    "NetworkInterfaceName": String,
    "PrimaryIpAddress": String,
    "InstanceType": String,
    "Ipv6AddressCount": Integer,
    "NetworkInterfaceTrafficMode": String,
    "Ipv6Addresses": List,
    "QueueNumber": Integer,
    "SecurityGroupIds": List,
    "NetworkInterfaceId": String,
    "DeleteOnRelease": Boolean,
    "NetworkCardIndex": Integer,
    "QueuePairNumber": Integer
  }
]

EniMappings properties

Property

Type

Required

Editable

Description

Constraint

SecurityGroupId

String

No

Yes

The ID of the security group to which the ENI belongs.

The security group and the ECS instances must reside in the same VPC.

VSwitchId

String

No

No

The vSwitch ID of the ENI.

None.

Description

String

No

Yes

The description of the ENI.

The description must be 2 to 256 characters in length, and cannot start with http:// or https://.

NetworkInterfaceName

String

No

Yes

The ENI name.

The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

PrimaryIpAddress

String

No

No

The primary private IP address of the ENI.

The IP address must be an idle IP address within the CIDR block of the vSwitch.

If you leave this property empty, an idle IP address is assigned from the CIDR block of the vSwitch at random.

InstanceType

String

No

No

The ENI type.

You can attach up to two ENIs. If you attach only one ENI, you can configure a primary or secondary ENI. If you attach two ENIs, you must configure a primary ENI and a secondary ENI.

Valid values:

  • Primary

  • Secondary (default)

Ipv6AddressCount

Integer

No

No

The number of IPv6 addresses to generate for the primary ENI at random.

Valid values: 1 to 10.

Take note of the following items:

  • This property takes effect only when NetworkInterface.InstanceType is set to Primary. If NetworkInterface.InstanceType is set to Secondary or left empty, you cannot specify NetworkInterface.Ipv6AddressCount.

  • After you specify NetworkInterface.Ipv6AddressCount, you cannot specify Ipv6AddressCount, Ipv6Address, or NetworkInterface.Ipv6Address.

NetworkInterfaceTrafficMode

String

No

No

The communication mode of the ENI.

Valid values:

  • Standard (default): uses the TCP communication mode.

  • HighPerformance: uses the remote direct memory access (RDMA) communication mode with the Elastic RDMA Interface (ERI) feature enabled.

Note

The number of ENIs in RDMA mode that can be attached to an instance cannot exceed the maximum number of ENIs that the instance type supports. For more information, see Overview of instance families.

Ipv6Addresses

List

No

No

The one or more IPv6 addresses to assign to the primary ENI.

You can specify up to 10 IPv6 addresses.

Take note of the following items:

  • This property takes effect only when NetworkInterface.InstanceType is set to Primary. If NetworkInterface.InstanceType is set to Secondary or left empty, you cannot specify NetworkInterface.Ipv6Addresses.

  • If you specify NetworkInterface.Ipv6Addresses, you must set Amount to 1 and cannot specify Ipv6AddressCount, Ipv6Address.N, or NetworkInterface.N.Ipv6AddressCount.

QueueNumber

Integer

No

No

The number of queues supported by the ENI.

Take note of the following items:

  • Valid values: 1 and 2. If you attach only one ENI, you can configure a primary or secondary ENI. If you attach two ENIs, you must configure a primary ENI and a secondary ENI.

  • The value of this property cannot exceed the maximum number of queues per ENI allowed for the instance type.

  • The total number of queues for all ENIs on an instance cannot exceed the queue quota for the instance type. To obtain the maximum number of queues per ENI for an instance type and the queue quota for the instance type, you can call the DescribeInstanceTypes operation and query the MaximumQueueNumberPerEni and TotalEniQueueQuantity values.

  • If NetworkInterface.InstanceType is set to Primary and QueueNumber is specified, you cannot specify NetworkInterfaceQueueNumber.

SecurityGroupIds

List

No

No

The IDs of one or more security groups to which the ENI belongs.

Take note of the following items:

  • If NetworkInterface.N.InstanceType is set to Primary, you must specify NetworkInterface.SecurityGroupIds or NetworkInterface.SecurityGroupId. In this case, NetworkInterface.SecurityGroupIds has the same effect as SecurityGroupIds. In addition, you cannot specify SecurityGroupId, SecurityGroupIds, or NetworkInterface.SecurityGroupId.

  • If NetworkInterface.N.InstanceType is set to Secondary or left empty, NetworkInterface.SecurityGroupIds is optional. The default value is the IDs of one or more security groups to which the ECS instances belong.

NetworkInterfaceId

String

No

No

The ID of the ENI that you want to attach to the instance.

This property takes effect only for secondary ENIs. After you use this property to specify an existing secondary ENI, you cannot configure other properties that are used to create the ENI.

DeleteOnRelease

Boolean

No

No

Specifies whether to retain the ENI when the associated instance is released.

Valid values:

  • true

  • false

NetworkCardIndex

Integer

No

No

The network card index that you want to specify for the ENI.

  • You can specify network card indexes only for instances of specific instance types.

  • If NetworkInterface.N.InstanceType is set to Primary, you must set NetworkCardIndex to 0 for instance types that support network cards.

  • If NetworkInterface.N.InstanceType is set to Secondary or left empty, you can specify NetworkCardIndex based on instance types if the instance types support network cards. For more information, see Overview of instance families.

QueuePairNumber

Integer

No

No

The number of queues supported by the ENI in RDMA mode.

QueuePairNumber is of the Long data type. The precision of the property value may be lost during the serialization or deserialization process. You must make sure that the value does not exceed 9007199254740991.

PrivatePoolOptions syntax

"PrivatePoolOptions": [
  {
    "Id": String,
    "MatchCriteria": String
  }
]

PrivatePoolOptions properties

Property

Type

Required

Editable

Description

Constraint

Id

String

No

No

The ID of the private pool. The ID of a private pool is the same as the ID of the elasticity assurance or capacity reservation for which the private pool is generated.

None.

MatchCriteria

String

No

No

The type of the private pool to use to start the instance. A private pool is generated after an elasticity assurance or a capacity reservation takes effect.

Valid values:

  • Open: open private pool. The system uses the capacity in a matching open private pool. If no matching open private pool exists, the system uses the capacity in public pools. When you set this property to Open, you do not need to specify PrivatePoolOptions.Id.

  • Target: specified private pool. The system uses the capacity in a specified private pool. If no capacity is available in the specified private pool, the instance fails to be started. When you set this property to Target, you must specify PrivatePoolOptions.Id.

  • None (default): no private pool. The system does not use the capacity in private pools.

PrivatePoolOptions.MatchCriteria must be set to None or left empty in the following scenarios:

  • Create a preemptible instance.

  • Create an ECS instance in the classic network.

  • Create an ECS instance on a dedicated host.

NetworkOptions syntax

"NetworkOptions": {
  "EnableJumboFrame": Boolean
}

NetworkOptions property

Property

Type

Required

Editable

Description

Constraint

EnableJumboFrame

Boolean

No

No

Specifies whether to enable the jumbo frame feature for the instance.

Valid values:

  • false: does not enable the jumbo frame feature for the instance. The maximum transmission unit (MTU) value of all ENIs on the instance is set to 1500.

  • true: enables the jumbo frame feature for the instance. The MTU value of all ENIs on the instance is set to 8500.

Default value: true.

Note

The jumbo frame feature is supported only by specific instance types whose generations are later than the eighth generation. For more information, see MTUs.

CpuOptions syntax

"CpuOptions": {
  "ThreadsPerCore": Integer,
  "Core": Integer
}

CpuOptions properties

Property

Type

Required

Editable

Description

Constraint

ThreadsPerCore

Integer

No

No

The number of threads per core.

The number of vCPUs of an ECS instance is calculated based on the following formula: Number of vCPUs = CpuOptions.Core value × CpuOptions.ThreadsPerCore value.

Core

Integer

No

No

The number of physical CPU cores.

You cannot specify a custom value for this property. You must set this property to one of its default values.

For more information about the default values, see Specify and view CPU options.

ImageOptions syntax

"ImageOptions": {
  "LoginAsNonRoot": Boolean
}

ImageOptions property

Property

Type

Required

Editable

Description

Constraint

LoginAsNonRoot

Boolean

No

No

Specifies whether the instance that uses the image supports the logons of the ecs-user user.

Valid values:

  • true

  • false

SecurityOptions syntax

"SecurityOptions": {
  "TrustedSystemMode": String
}

SecurityOptions property

Property

Type

Required

Editable

Description

Constraint

TrustedSystemMode

String

No

No

The trusted system mode.

Set the value to vTPM. The trusted system mode supports the g7, c7, and r7 instance families and the g7t, c7t, and r7t security-enhanced instance families. You must specify this property when you create ECS instances of the preceding instance families. If you use Alibaba Cloud Trusted System, you must set this property to vTPM. Then, Alibaba Cloud Trusted System performs trust verifications when the instances are started. If you do not use Alibaba Cloud Trusted System, you can leave this property empty. In this case, you must be aware that if you set SecurityOptions.ConfidentialComputingMode to Enclave to use an enclave-based confidential computing environment for ECS instances, Alibaba Cloud Trusted System is enabled for the instances. When you call API operations to create ECS instances that use Alibaba Cloud Trusted System, you can call only the RunInstances operation to specify SecurityOptions.TrustedSystemMode. The CreateInstance operation does not support SecurityOptions.TrustedSystemMode.

Note

If you configure an instance as a trusted instance when you create the instance, you can use only an image that supports Alibaba Cloud Trusted System to replace the system disk of the instance.

For more information about the trusted system, see "Overview of trusted computing capabilities".

SchedulerOptions syntax

"SchedulerOptions": {
  "ManagedPrivateSpaceId": String,
  "DedicatedHostClusterId": String
}

SchedulerOptions properties

Property

Type

Required

Editable

Description

Constraint

DedicatedHostClusterId

String

No

No

The ID of the dedicated host cluster in which you want to create the ECS instance. After you specify this property, the system automatically selects one dedicated host from the specified cluster to create the instance.

Note

This property takes effect only when Tenancy is set to host.

When you specify both DedicatedHostId and SchedulerOptions.DedicatedHostClusterId, take note of the following items:

  • If the specified dedicated host belongs to the specified dedicated host cluster, the instance is preferentially deployed on the specified dedicated host.

  • If the specified dedicated host does not belong to the specified dedicated host cluster, the instance fails to be created.

You can call the DescribeDedicatedHostClusters operation to query the IDs of dedicated host clusters.

ManagedPrivateSpaceId

String

No

No

The ID of the managed private pool.

None.

Return values

Fn::GetAtt

  • InstanceIds: the IDs of the ECS instances. An instance ID is a GUID that is generated by the system for an instance.

  • PrivateIps: the private IP addresses of the ECS instances in the VPC. This property takes effect when NetworkType is set to vpc. The value is a JSON array that can contain up to 100 IP addresses separated by commas (,). Example: ["172.16.XX.XX", "172.16.XX.XX", … "172.16.XX.XX"].

  • InnerIps: the private IP addresses of the ECS instances in the classic network. This property takes effect when NetworkType is set to classic. The value is a JSON array that can contain up to 100 IP addresses separated by commas (,). Example: ["10.1.XX.XX", "10.1.XX.XX", … "10.1.XX.XX"].

  • PublicIps: the public IP addresses of the ECS instances in the classic network. This property takes effect when NetworkType is set to classic. The value is a JSON array that can contain up to 100 IP addresses separated by commas (,). Example: ["42.1.XX.XX", "42.1.XX.XX", … "42.1.XX.XX"].

  • HostNames: the hostnames of the ECS instances.

  • OrderId: the order ID of the ECS instances.

  • ZoneIds: the zone IDs.

  • Ipv6AddressIds: the IPv6 address IDs of the ECS instances.

    Note

    The IPv6 address IDs are returned in a list that has two levels of nesting. If an ECS instance does not have an IPv6 address, the element at the relevant position in the list is empty. If all ECS instances do not have IP addresses, null is returned.

  • Ipv6Addresses: the IPv6 addresses of the ECS instances.

    Note

    The IPv6 addresses are returned in a list that has two levels of nesting. If an ECS instance does not have an IPv6 address, the element at the relevant position in the list is empty. If all ECS instances do not have IP addresses, null is returned.

  • RelatedOrderIds: the related order IDs of the ECS instances.

Examples

The following sample code provides examples on how to create the OpsEcsInstance and ProdEcsInstance ECS instances and configure the password-free logon of the OpsEcsInstance instance for the ProdEcsInstance instance.

If you want to receive signals of the execution results of user-data scripts of the ECS instances, you can configure ALIYUN::ROS::WaitCondition and ALIYUN::ROS::WaitConditionHandle. For more information, see ALIYUN::ROS::WaitConditionHandle and ALIYUN::ROS::WaitCondition.

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Description: Creates VPC ECS instance
Parameters:
  VpcId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description:
      en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud
       
    Label:
      en: VPC ID
       
  VSwitchZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
       
      en: VSwitch Availability Zone
    Label:
       
      en: VSwitch Availability Zone
  VSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${VSwitchZoneId}
    Type: String
    Description:
      en: Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query
       
    Label:
      en: VSwitch ID
       
  SecurityGroupId:
    Type: String
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
    Description:
      en: Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security
       
    Label:
      en: Business Security Group ID
       
  InstanceType:
    Type: String
    Description:
       
      en: Fill in the specifications that can be used under the VSwitch availability zone.
    Label:
       
      en: Instance Type
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      ZoneId: ${VSwitchZoneId}
  SystemDiskCategory:
    Type: String
    Label:
      en: System Disk Type
       
    Description:
      en: System Disk Type
       
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      ZoneId: ${VSwitchZoneId}
      InstanceType: ${InstanceType}
Resources:
  OpsEcsInstance:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      MaxAmount: 1
      HostName: OpsEcsInstance
      UserData:
        Fn::Sub:
          - |
            #!/bin/bash
            RootPassword=${RootPassword}
            ProdIP=${ProdIP}
            SSHConfig() {
            echo '[ ! -f /root/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa &>/dev/null' >> /tmp/auto_ssh.sh
            echo 'while read line;do' >> /tmp/auto_ssh.sh
            echo '        ip=`echo $line | cut -d " " -f1`' >> /tmp/auto_ssh.sh
            echo '        user_name=`echo $line | cut -d " " -f2`' >> /tmp/auto_ssh.sh
            echo '        pass_word=`echo $line | cut -d " " -f3`' >> /tmp/auto_ssh.sh
            echo 'expect <<EOF' >> /tmp/auto_ssh.sh
            echo '        spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $user_name@$ip' >> /tmp/auto_ssh.sh
            echo '        expect {' >> /tmp/auto_ssh.sh
            echo '                  "yes/no" { send "yes\n";exp_continue}' >> /tmp/auto_ssh.sh
            echo '                  "password" { send "$pass_word\n"}' >> /tmp/auto_ssh.sh
            echo '        }' >> /tmp/auto_ssh.sh
            echo '        expect eof' >> /tmp/auto_ssh.sh
            echo 'EOF' >> /tmp/auto_ssh.sh
            echo 'done < /tmp/host_ip.txt' >> /tmp/auto_ssh.sh
            }
            SetHostsConfig() {
            echo "`ifconfig eth0 | awk '/inet /{print $2}'` root ${RootPassword}" >> /tmp/host_ip.txt
            echo "${ProdIP} root ${RootPassword}" >> /tmp/host_ip.txt
            sh /tmp/auto_ssh.sh
            }
            main() {
            yum install -y expect
            SSHConfig
            SetHostsConfig
            rm -rf /tmp/host_ip.txt
            }
            main
          - ProdIP:
              Fn::Select:
                - '0'
                - Fn::GetAtt:
                    - ProdEcsInstance
                    - PrivateIps
            RootPassword: Admin@123!
      VpcId:
        Ref: VpcId
      SecurityGroupId:
        Ref: SecurityGroupId
      VSwitchId:
        Ref: VSwitchId
      ImageId: centos_7
      AllocatePublicIP: false
      InstanceType:
        Ref: InstanceType
      SystemDiskSize: 40
      SystemDiskCategory:
        Ref: SystemDiskCategory
      Password: Admin@123!
  ProdEcsInstance:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      MaxAmount: 1
      HostName: ProdEcsInstance
      SystemDiskCategory:
        Ref: SystemDiskCategory
      VpcId:
        Ref: VpcId
      SecurityGroupId:
        Ref: SecurityGroupId
      SystemDiskSize: 40
      ImageId: centos_7
      VSwitchId:
        Ref: VSwitchId
      Password: Admin@123!
      InstanceType:
        Ref: InstanceType
      AllocatePublicIP: false
Outputs: {}                  

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Creates VPC ECS instance",
  "Parameters": {
    "VpcId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "en": "Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud",
         
      },
      "Label": {
        "en": "VPC ID",
         
      }
    },
    "VSwitchZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
         
        "en": "VSwitch Availability Zone"
      },
      "Label": {
         
        "en": "VSwitch Availability Zone"
      }
    },
    "VSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${VSwitchZoneId}"
      },
      "Type": "String",
      "Description": {
        "en": "Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query",
         
      },
      "Label": {
        "en": "VSwitch ID",
         
      }
    },
    "SecurityGroupId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}"
      },
      "Description": {
        "en": "Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security",
         
      },
      "Label": {
        "en": "Business Security Group ID",
         
      }
    },
    "InstanceType": {
      "Type": "String",
      "Description": {
         
        "en": "Fill in the specifications that can be used under the VSwitch availability zone."
      },
      "Label": {
         
        "en": "Instance Type"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "ZoneId": "${VSwitchZoneId}"
      }
    },
    "SystemDiskCategory": {
      "Type": "String",
      "Label": {
        "en": "System Disk Type",
         
      },
      "Description": {
        "en": "System Disk Type",
         
      },
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "ZoneId": "${VSwitchZoneId}",
        "InstanceType": "${InstanceType}"
      }
    }
  },
  "Resources": {
    "OpsEcsInstance": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "MaxAmount": 1,
        "HostName": "OpsEcsInstance",
        "UserData": {
          "Fn::Sub": [
            "#!/bin/bash\nRootPassword=${RootPassword}\nProdIP=${ProdIP}\nSSHConfig() {\necho '[ ! -f /root/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -P \"\" -f ~/.ssh/id_rsa &>/dev/null' >> /tmp/auto_ssh.sh\necho 'while read line;do' >> /tmp/auto_ssh.sh\necho '        ip=`echo $line | cut -d \" \" -f1`' >> /tmp/auto_ssh.sh\necho '        user_name=`echo $line | cut -d \" \" -f2`' >> /tmp/auto_ssh.sh\necho '        pass_word=`echo $line | cut -d \" \" -f3`' >> /tmp/auto_ssh.sh\necho 'expect <<EOF' >> /tmp/auto_ssh.sh\necho '        spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $user_name@$ip' >> /tmp/auto_ssh.sh\necho '        expect {' >> /tmp/auto_ssh.sh\necho '                  \"yes/no\" { send \"yes\\n\";exp_continue}' >> /tmp/auto_ssh.sh\necho '                  \"password\" { send \"$pass_word\\n\"}' >> /tmp/auto_ssh.sh\necho '        }' >> /tmp/auto_ssh.sh\necho '        expect eof' >> /tmp/auto_ssh.sh\necho 'EOF' >> /tmp/auto_ssh.sh\necho 'done < /tmp/host_ip.txt' >> /tmp/auto_ssh.sh\n}\nSetHostsConfig() {\necho \"`ifconfig eth0 | awk '/inet /{print $2}'` root ${RootPassword}\" >> /tmp/host_ip.txt\necho \"${ProdIP} root ${RootPassword}\" >> /tmp/host_ip.txt\nsh /tmp/auto_ssh.sh\n}\nmain() {\nyum install -y expect\nSSHConfig\nSetHostsConfig\nrm -rf /tmp/host_ip.txt\n}\nmain\n",
            {
              "ProdIP": {
                "Fn::Select": [
                  "0",
                  {
                    "Fn::GetAtt": [
                      "ProdEcsInstance",
                      "PrivateIps"
                    ]
                  }
                ]
              },
              "RootPassword": "Admin@123!"
            }
          ]
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "ImageId": "centos_7",
        "AllocatePublicIP": false,
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "SystemDiskSize": 40,
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "Password": "Admin@123!"
      }
    },
    "ProdEcsInstance": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "MaxAmount": 1,
        "HostName": "ProdEcsInstance",
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "SystemDiskSize": 40,
        "ImageId": "centos_7",
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "Password": "Admin@123!",
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "AllocatePublicIP": false
      }
    }
  },
  "Outputs": {
  }
}