Use ALIYUN::ECS::InstanceGroupClone to clone a group of ECS instances.
Syntax
{
"Type": "ALIYUN::ECS::InstanceGroupClone",
"Properties": {
"BackendServerWeight": Integer,
"SystemDiskAutoSnapshotPolicyId": String,
"DiskMappings": List,
"Period": Number,
"LaunchTemplateName": String,
"RamRoleName": String,
"ResourceGroupId": String,
"KeyPairName": String,
"SystemDiskDiskName": String,
"PeriodUnit": String,
"Description": String,
"Tags": List,
"AutoRenewPeriod": Number,
"ImageId": String,
"AutoRenew": String,
"SpotStrategy": String,
"SourceInstanceId": String,
"EniMappings": List,
"Password": String,
"PasswordInherit": Boolean,
"MaxAmount": Integer,
"AutoReleaseTime": String,
"SystemDiskCategory": String,
"LoadBalancerIdToAttach": String,
"LaunchTemplateId": String,
"LaunchTemplateVersion": String,
"ZoneId": String,
"InternetMaxBandwidthOut": Integer,
"InstanceName": String,
"DeletionProtection": Boolean,
"DeploymentSetId": String,
"Ipv6AddressCount": Integer,
"SecurityGroupId": String,
"SecurityGroupIds": List,
"SpotPriceLimit": String,
"HpcClusterId": String,
"SystemDiskDescription": String,
"Ipv6Addresses": List,
"SystemDiskProvisionedIops": Integer,
"SystemDiskBurstingEnabled": Boolean,
"SystemDiskKMSKeyId": String,
"SystemDiskStorageClusterId": String,
"InternetMaxBandwidthIn": Integer,
"UpdatePolicy": String,
"SystemDiskEncryptAlgorithm": String,
"SystemDiskEncrypted": String,
"SecurityOptions": Map,
"ImageOptions": Map,
"NetworkOptions": Map,
"HostNames": List,
"NetworkInterfaceQueueNumber": Integer,
"UniqueSuffix": Boolean,
"CpuOptions": Map
}
}Properties
Property name | Type | Required | Allow updates | Description | Constraints |
MaxAmount | Integer | Yes | Yes | The number of ECS instances to create at a time. | Valid values: 1 to 100. |
SourceInstanceId | String | Yes | No | The ID of the ECS instance to clone. | The instance type, image, bandwidth billing method, bandwidth limit, network type, and other configurations are cloned. If the source ECS instance is added to multiple security groups, the new instance is added to the first security group of the source instance. |
AutoReleaseTime | String | No | No | The time when the new ECS instance is automatically released. | The time must be in the ISO 8601 format. For example: |
AutoRenew | String | No | Yes | Indicates whether to enable auto-renewal. | Valid values:
This parameter is required when InstanceChargeType is set to PrePaid. |
AutoRenewPeriod | Number | No | Yes | The auto-renewal period. | This parameter is required when AutoRenew is set to true. Valid values:
|
BackendServerWeight | Integer | No | No | The weight of the new ECS instance in the SLB instance. | Valid values: 0 to 100. Default value: 100. |
CpuOptions | Map | No | No | The CPU properties. | For more information, see CpuOptions properties. |
DeletionProtection | Boolean | No | No | The release protection attribute of the new instance. It specifies whether the instance can be released through the console or by calling the DeleteInstance API operation. | Valid values:
|
DeploymentSetId | String | No | Yes | The ID of the deployment set. | None |
Description | String | No | Yes | The description. | The description can be up to 256 characters in length. |
DiskMappings | List | No | Yes | The disks to attach. | A maximum of 16 disks are supported. For more information, see DiskMappings properties. |
EniMappings | List | No | Yes | The ENIs to attach to the instance. | A maximum of one ENI can be attached to the instance. For more information, see EniMappings properties. |
HostNames | List | No | No | When you create multiple instances, specify a different hostname for each instance. | None |
HpcClusterId | String | No | Yes | The ID of the E-HPC cluster to which the new instance belongs. | None |
ImageId | String | No | Yes | The ID of the image used to start the ECS instance. This can be a public image, custom image, or Alibaba Cloud Marketplace image. | You can use a fuzzy match to specify a public image ID without specifying a complete public image ID. For example:
|
ImageOptions | Map | No | No | The image properties. | For more information, see ImageOptions properties. |
InstanceName | String | No | Yes | The name of the new instance. | The name can be up to 128 characters in length. It can contain letters, Chinese characters, digits, underscores (_), periods (.), and hyphens (-). |
InternetMaxBandwidthIn | Integer | No | No | Maximum Internet outbound bandwidth. | Unit: Mbit/s. Valid values: 0 to 200. Default value: 200. |
InternetMaxBandwidthOut | Integer | No | No | The maximum outbound public bandwidth. | Unit: Mbit/s. Valid values:
|
Ipv6AddressCount | Integer | No | Yes | The number of randomly generated IPv6 addresses to assign to the ENI. | You cannot specify both Ipv6Addresses and Ipv6AddressCount. |
Ipv6Addresses | List | No | Yes | One or more IPv6 addresses to assign to the ENI. | The list can contain a maximum of one address. Changes to this property do not affect existing instances. You cannot specify both Ipv6Addresses and Ipv6AddressCount. |
KeyPairName | String | No | Yes | The name of the key pair to attach to the new ECS instance. | This parameter is ignored for Windows ECS instances. If you specify KeyPairName, the value of Password is still set for the instance, but password-based logon is disabled for Linux systems. |
LaunchTemplateId | String | No | Yes | The ID of the launch template. | None |
LaunchTemplateName | String | No | Yes | The name 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. |
LoadBalancerIdToAttach | String | No | No | The ID of the SLB instance to which the new ECS instance is added. | None |
NetworkInterfaceQueueNumber | Integer | No | No | The number of queues for the primary NIC. | Note:
|
NetworkOptions | Map | No | No | Network-related properties and parameters. | For more information, see NetworkOptions properties. |
Password | String | No | Yes | The logon password for the new ECS instance. | The password must be 8 to 30 characters in length. It must contain letters, digits, and special characters. Supported special characters: If you specify this parameter, use the HTTPS protocol to call the API operation to prevent password leakage. |
PasswordInherit | Boolean | No | No | Indicates whether to use the preset password of the image. | Valid values:
Note When you use this parameter, the Password parameter must be empty, and you must ensure that a password is set for the image. |
Period | Number | No | Yes | The billing cycle. | Valid values: 1 to 9, 12, 24, 36, 48, and 60. Unit: month. This parameter is required when InstanceChargeType is set to PrePaid. This parameter is optional when InstanceChargeType is set to PostPaid. |
PeriodUnit | String | No | Yes | Resource purchase duration. | Valid values:
|
RamRoleName | String | No | Yes | The name of the instance RAM role for the new instance. | You can call ListRoles to query the instance RAM role name. For more information, see Create a role and Obtain a list of roles. |
ResourceGroupId | String | No | No | The ID of the resource group to which the new instance belongs. | None |
SecurityGroupId | String | No | No | The security group to which the new instance belongs. | You cannot specify both SecurityGroupId and SecurityGroupIds. |
SecurityGroupIds | List | No | No | The list of security groups to which the new instance belongs. | For more information, see Security groups. You cannot specify both SecurityGroupId and SecurityGroupIds. |
SecurityOptions | Map | No | No | The trusted system properties. | For more information, see SecurityOptions properties. |
SpotPriceLimit | String | No | No | The maximum hourly price for the new instance. | The value can have up to three decimal places. SpotPriceLimit takes effect when SpotStrategy is set to SpotWithPriceLimit. |
SpotStrategy | String | No | Yes | The bidding policy for the pay-as-you-go instance. | This parameter is required when InstanceChargeType is set to PostPaid. Valid values:
|
SystemDiskAutoSnapshotPolicyId | String | No | Yes | The ID of the automatic snapshot policy for the system disk. | None |
SystemDiskBurstingEnabled | Boolean | No | Yes | Indicates whether to enable bursting for the system disk. | Valid values:
|
SystemDiskCategory | String | No | Yes | The type of the system disk. | Valid values:
|
SystemDiskDescription | String | No | Yes | The description of the system disk. | None |
SystemDiskDiskName | String | No | Yes | The name of the system disk. | The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character and cannot start with |
SystemDiskEncryptAlgorithm | String | No | Yes | The encryption algorithm used for the system disk. | Valid values:
|
SystemDiskEncrypted | String | No | Yes | Indicates whether to encrypt the system disk. | Valid values:
|
SystemDiskKMSKeyId | String | No | Yes | The ID of the KMS key used for the system disk. | None |
SystemDiskProvisionedIops | Integer | No | Yes | The provisioned IOPS of the system disk. | None |
SystemDiskStorageClusterId | String | No | Yes | The ID of the dedicated block storage cluster for the system disk. | None |
Tags | List | No | Yes | The custom tags. | A maximum of 20 tags are supported. Format: For more information, see Tags properties. |
UniqueSuffix | Boolean | No | No | When you create multiple instances, indicates whether to automatically add a sequential suffix to the | The sequential suffix starts from 001 and increments. The maximum value cannot exceed 999. Valid values:
When For more information, see Sequentially set instance names or hostnames. |
UpdatePolicy | String | No | Yes | Specifies the update policy. | Valid values:
|
ZoneId | String | No | No | The ID of the zone. | None |
DiskMappings syntax
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Encrypted": String,
"KMSKeyId": String,
"Device": String,
"SnapshotId": String,
"Size": String,
"PerformanceLevel": String,
"AutoSnapshotPolicyId": String,
"ProvisionedIops": Integer,
"BurstingEnabled": Boolean,
"StorageClusterId": String
}
]DiskMappings properties
Property name | Type | Required | Updatable | Description | Constraints |
Size | String | Yes | No | The size of the data disk. | Unit: GB. |
AutoSnapshotPolicyId | String | No | No | The ID of the automatic snapshot policy. | None |
BurstingEnabled | Boolean | No | No | Indicates whether to enable bursting. | Valid values:
|
Category | String | No | No | The type of the data disk. | Valid values:
|
Description | String | No | No | The description of the data disk. | The description must be 2 to 256 characters in length. It cannot start with |
Device | String | No | No | The name of the data disk in the ECS instance. | Example: |
DiskName | String | No | No | The name of the data disk. | The name can be up to 128 characters in length. It can contain letters, Chinese characters, digits, underscores (_), periods (.), and hyphens (-). |
Encrypted | String | No | No | Indicates whether to encrypt the data disk. | Valid values:
|
KMSKeyId | String | No | No | The ID of the KMS key for the data disk. | None |
PerformanceLevel | String | No | No | When you create a system disk using an enterprise SSD, you can set its performance level. | Valid values:
For information about how to select an ESSD performance level, see ESSDs. |
ProvisionedIops | Integer | No | No | The provisioned IOPS. | None |
SnapshotId | String | No | No | The ID of the snapshot. | None |
StorageClusterId | String | No | No | The ID of the dedicated block storage cluster. | None |
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,
"QueuePairNumber": Integer,
"NetworkInterfaceId": String,
"DeleteOnRelease": Boolean,
"NetworkCardIndex": Integer
}
]EniMappings properties
Property name | Type | Required | Updatable | Description | Constraints |
DeleteOnRelease | Boolean | No | No | Indicates whether to retain the NIC when the instance is released | Valid values:
|
Description | String | No | Yes | The description of the ENI. | The description must be 2 to 256 characters in length and cannot start with |
InstanceType | String | No | No | The type of the ENI. | You can set a maximum of two NICs. When you set one ENI, you can set it as a primary or secondary ENI. When you set two ENIs, you can only set one as a primary ENI and the other as a secondary ENI. Valid values:
|
Ipv6AddressCount | Integer | No | No | The number of randomly generated IPv6 addresses to assign to the primary NIC. | Valid values: 1 to 10. Notes:
|
Ipv6Addresses | List | No | No | One or more IPv6 addresses to assign to the primary NIC. | You can set a maximum of 10 IPv6 addresses. Notes:
|
NetworkCardIndex | Integer | No | No | The index of the physical NIC specified by the NIC. |
|
NetworkInterfaceId | String | No | No | The ID of the ENI to attach to the instance. | This parameter is effective only for secondary ENIs. After you specify an existing secondary ENI, you cannot configure other NIC creation parameters. |
NetworkInterfaceName | String | No | Yes | The name of the ENI. | The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character and cannot start with |
NetworkInterfaceTrafficMode | String | No | No | The communication mode of the NIC. | Valid values:
Note The number of ENIs in RDMA mode cannot exceed the limit for the instance family. For more information, see Instance families. |
PrimaryIpAddress | String | No | No | The primary private IP address of the ENI. | The specified IP address must be an available address within the CIDR block of the vSwitch. If you do not specify an IP address, an available address from the vSwitch's CIDR block is randomly assigned. |
QueueNumber | Integer | No | No | The number of queues for the ENI. | Notes:
|
QueuePairNumber | Integer | No | No | The number of queues for the RDMA NIC. | This field is of the Long type. Precision may be lost during serialization or deserialization. Ensure that the value does not exceed 9007199254740991. |
SecurityGroupId | String | No | Yes | The ID of the security group. | The security group must be in the same VPC. |
SecurityGroupIds | List | No | No | One or more security group IDs to which the ENI belongs. | Notes:
|
VSwitchId | String | No | No | The ID of the vSwitch. | None |
SecurityOptions syntax
"SecurityOptions": {
"TrustedSystemMode": String
}SecurityOptions properties
Property name | Type | Required | Updatable | Description | Constraints |
TrustedSystemMode | String | No | No | The trusted system mode. | Valid value: vTPM. Currently, the trusted system mode is supported by the g7, c7, and r7 instance families, and the security-enhanced instance families (g7t, c7t, and r7t). You must set this parameter when you create ECS instances of these instance families. The details are as follows: If you use the Alibaba Cloud Trusted System, set this parameter to vTPM. This allows the instance to complete a trusted verification through the Alibaba Cloud Trusted System upon startup. If you do not use the Alibaba Cloud Trusted System, you can leave this parameter empty. However, note that if the ECS instance you create uses the Enclave confidential computing mode (SecurityOptions.ConfidentialComputingMode=Enclave), the trusted system is also enabled for the ECS instance. When you use OpenAPI to create an ECS instance with a trusted system, you can only call RunInstances. CreateInstance does not currently support setting the SecurityOptions.TrustedSystemMode parameter. Note If you specify an instance as a trusted instance when you create it, you can only use an image that supports the trusted system when you replace the system disk. |
ImageOptions syntax
"ImageOptions": {
"LoginAsNonRoot": Boolean
}ImageOptions properties
Property name | Type | Required | Updatable | Description | Constraints |
LoginAsNonRoot | Boolean | No | No | Indicates whether instances that use this image support logon as the ecs-user user. | Valid values:
|
CpuOptions syntax
"CpuOptions": {
"ThreadsPerCore": Integer,
"Core": Integer
}CpuOptions properties
Property name | Type | Required | Updatable | Description | Constraints |
Core | Integer | No | No | The number of CPU cores. | You cannot customize this parameter. You can only use the default value. Default value: See Change CPU options. |
ThreadsPerCore | Integer | No | No | The number of threads per CPU core. | The number of vCPUs of an ECS instance = Value of |
NetworkOptions syntax
"NetworkOptions": {
"EnableJumboFrame": Boolean
}NetworkOptions properties
Property name | Type | Required | Updatable | Description | Constraints |
EnableJumboFrame | Boolean | No | No | Indicates whether to enable the jumbo frame feature for the instance. | Valid values:
Note Only some instance types of generation VIII or later support the jumbo frame feature. For more information, see Jumbo frames. |
Tags syntax
"Tags": [
{
"Value": String,
"Key": String
}
]Tags properties
Property name | Type | Required | Updatable | Description | Constraints |
Key | String | Yes | No | The tag key. | The key must be 1 to 128 characters in length and cannot start with |
Value | String | No | No | The tag value. | The value must be 0 to 128 characters in length and cannot start with |
Return values
Fn::GetAtt
InstanceIds: The IDs of the new instances. An instance ID is a globally unique identifier that is generated by the system for an instance.
PrivateIps: A list of the private IP addresses of the VPC-type instances. This attribute is returned when the NetworkType parameter is set to
vpc. Example: ["172.16.XX.XX", "172.16.XX.XX", ..., "172.16.XX.XX"]. The list can contain up to 100 IP addresses.InnerIps: A list of the private IP addresses of the Classic Network-type instances. This attribute is returned when the NetworkType parameter is set to
classic. Example: ["10.1.XX.XX", "10.1.XX.XX", ..., "10.1.XX.XX"]. The list can contain up to 100 IP addresses.PublicIps: A list of the public IP addresses of the Classic Network-type instances. This attribute is returned when the NetworkType parameter is set to
classic. Example: ["42.1.XX.XX", "42.1.XX.XX", ..., "42.1.XX.XX"]. The list can contain up to 100 IP addresses.HostNames: A list of the hostnames of the new instances.
OrderId: A list of the order IDs for the new instances.
ZoneIds: A list of the IDs of the zones.
RelatedOrderIds: A list of the related order IDs for the created ECS instances.
Ipv6AddressIds: A list of the IPv6 address IDs for the created ECS instances. Note: This attribute returns a two-dimensional list. If an instance does not have any IPv6 addresses, the corresponding element in the list is an empty list. If none of the instances have an IPv6 address, null is returned.
Ipv6Addresses: A list of the IPv6 addresses for the created ECS instances. Note: This attribute returns a two-dimensional list. If an instance does not have any IPv6 addresses, the corresponding element in the list is null. If none of the instances have an IPv6 address, null is returned.
Examples
ROSTemplateFormatVersion: '2015-09-01'
Description: According the existing ECS instance, clone a set of ECS instanes with the same configuration(InstanceType, ImageId, InternetChargeType, InternetMaxBandwidthOut, system disk, data disk configurations, VPC properties). The user only needs to specify SourceInstanceId.
Parameters:
SourceInstanceId:
Type: String
Description: The source ECS instance ID to be cloned
Label: Source Instance ID
InstanceName:
Type: String
Description: The instance name. The name must be 2 to 128 characters in length. It can contain letters, Chinese characters, digits, underscores (_), periods (.), and hyphens (-).
ConstraintDescription: '[2, 128] characters, consists of uppercase letter, lowercase letter, number or special characters.'
Label: Instance Name
Default: ClonedECS
MaxLength: 128
MinLength: 2
MaxAmount:
Type: Number
Description: The maximum number of ECS instances to create at a time. This value must be greater than or equal to the minimum number of ECS instances to create at a time.
ConstraintDescription: An integer within [1, 100]
Label: The Maximum of ECS Instances
MaxValue: 100
MinValue: 1
Default: 1
Password:
Type: String
Description: 'The password must be 8 to 30 characters in length. It must contain three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Supported special characters: ( ) ` ~ ! @ # $ % ^ * - + = | { } [ ] : ; ‘ , . ? /.'
ConstraintDescription: 'Length 8-30, must contain three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Supported special characters: ()`~!@#$%^*_-+=|{}[]:;'',.?/'
Label: ECS Instance Password
MaxLength: 30
MinLength: 8
AllowedPattern: '[a-zA-Z0-9-\(\)\`\~\!@\#\$%\^\*-+=\|\{\}\[\]\:\;\‘\,\.\?\/]*'
NoEcho: true
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- InstanceName
- SourceInstanceId
- MaxAmount
- Password
Label:
default: ECS
TemplateTags:
- acs:example:elastic-computing:Specify SourceInstanceId to clone a group of ECS instances with the same configuration.
Resources:
ECSInstanceGroup:
Type: ALIYUN::ECS::InstanceGroupClone
Properties:
SourceInstanceId:
Ref: SourceInstanceId
MaxAmount:
Ref: MaxAmount
Password:
Ref: Password
Outputs:
InstanceIds:
Description: The instance ID list of created ecs instance
Value:
Fn::GetAtt:
- ECSInstanceGroup
- InstanceIds
PublicIps:
Description: Public IP address list of created ecs instance.
Value:
Fn::GetAtt:
- ECSInstanceGroup
- PublicIps
ZoneIds:
Description: Zone ID of created instance.
Value:
Fn::GetAtt:
- ECSInstanceGroup
- ZoneIds
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "According the existing ECS instance, clone a set of ECS instanes with the same configuration(InstanceType, ImageId, InternetChargeType, InternetMaxBandwidthOut, system disk, data disk configurations, VPC properties). The user only needs to specify SourceInstanceId.",
"Parameters": {
"SourceInstanceId": {
"Type": "String",
"Description": "The source ECS instance ID to be cloned",
"Label": "Source Instance ID"
},
"InstanceName": {
"Type": "String",
"Description": "The instance name. The name must be 2 to 128 characters in length. It can contain letters, Chinese characters, digits, underscores (_), periods (.), and hyphens (-).",
"ConstraintDescription": "[2, 128] characters, consists of uppercase letter, lowercase letter, number or special characters.",
"Label": "Instance Name",
"Default": "ClonedECS",
"MaxLength": 128,
"MinLength": 2
},
"MaxAmount": {
"Type": "Number",
"Description": "The maximum number of ECS instances to create at a time. This value must be greater than or equal to the minimum number of ECS instances to create at a time.",
"ConstraintDescription": "An integer within [1, 100]",
"Label": "The Maximum of ECS Instances",
"MaxValue": 100,
"MinValue": 1,
"Default": 1
},
"Password": {
"Type": "String",
"Description": "The password must be 8 to 30 characters in length. It must contain three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Supported special characters: ( ) ` ~ ! @ # $ % ^ * - + = | { } [ ] : ; ‘ , . ? /.",
"ConstraintDescription": "Length 8-30, must contain three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Supported special characters: ()`~!@#$%^*_-+=|{}[]:;',.?/",
"Label": "ECS Instance Password",
"MaxLength": 30,
"MinLength": 8,
"AllowedPattern": "[a-zA-Z0-9-\\(\\)\\`\\~\\!@\\#\\$%\\^\\*-+=\\|\\{\\}\\[\\]\\:\\;\\‘\\,\\.\\?\\/]*",
"NoEcho": true
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"InstanceName",
"SourceInstanceId",
"MaxAmount",
"Password"
],
"Label": {
"default": "ECS"
}
}
],
"TemplateTags": [
"acs:example:elastic-computing:Specify SourceInstanceId to clone a group of ECS instances with the same configuration."
]
}
},
"Resources": {
"ECSInstanceGroup": {
"Type": "ALIYUN::ECS::InstanceGroupClone",
"Properties": {
"SourceInstanceId": {
"Ref": "SourceInstanceId"
},
"MaxAmount": {
"Ref": "MaxAmount"
},
"Password": {
"Ref": "Password"
}
}
}
},
"Outputs": {
"InstanceIds": {
"Description": "The instance ID list of created ecs instance",
"Value": {
"Fn::GetAtt": [
"ECSInstanceGroup",
"InstanceIds"
]
}
},
"PublicIps": {
"Description": "Public IP address list of created ecs instance.",
"Value": {
"Fn::GetAtt": [
"ECSInstanceGroup",
"PublicIps"
]
}
},
"ZoneIds": {
"Description": "Zone ID of created instance.",
"Value": {
"Fn::GetAtt": [
"ECSInstanceGroup",
"ZoneIds"
]
}
}
}
}