ALIYUN::ECS::InstanceGroupClone is used to clone an Elastic Compute Service (ECS) instance to generate one or more new 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
  }
}

Properties

Property Type Required Editable Description Constraint
ResourceGroupId String No No The ID of the resource group to which the new ECS instance belongs. None.
HpcClusterId String No Yes The ID of the Elastic High Performance Computing (E-HPC) cluster to which the new ECS instance belongs. None.
SourceInstanceId String Yes No The ID of the source ECS instance that you want to clone. You can clone the information about the source ECS instance, including the instance type, image, bandwidth metering method, bandwidth limit, and network type. If the source ECS instance belongs to multiple security groups, the new instance is added to the first security group to which you add the source ECS instance.
MaxAmount Integer Yes Yes The number of new ECS instances that you can create at a time. Valid values: 1 to 100.
BackendServerWeight Integer No No The weight that is assigned to the new ECS instance in the Server Load Balancer (SLB) instance. Valid values: 0 to 100.

Default value: 100.

LoadBalancerIdToAttach String No No The ID of the SLB instance to which you attach the new ECS instance. None.
Description String No Yes The description of the new ECS instance. The description can be up to 256 characters in length.
ImageId String No Yes The ID of the image that is used to start the new ECS instance. You can use a public image, custom image, or Alibaba Cloud Marketplace image. When you specify a part of a public image ID, the system can match the complete ID of the public image. You do not need to specify the complete ID of the public image. Example:
  • If you specify ubuntu, the system matches the following complete image ID: ubuntu16_0402_64_20G_alibase_20170818.vhd.
  • If you specify ubuntu_14, the system matches the following complete image ID: ubuntu_14_0405_64_20G_alibase_20170824.vhd.
  • If you specify ubuntu*14*32, the system matches the following complete image ID: ubuntu_14_0405_32_40G_alibase_20170711.vhd.
  • If you enter ubuntu_16_0402_32, the system matches the following complete image ID: ubuntu_16_0402_32_40G_alibase_20170711.vhd.
InternetMaxBandwidthOut Integer No No The maximum outbound public bandwidth of the new ECS instance. Unit: Mbit/s.

Valid values:

  • Valid values for the pay-by-bandwidth metering method: 0 to 200
  • Valid values for the pay-by-data-transfer metering method: 1 to 200
SecurityGroupId String No No The ID of the security group to which the new ECS instance belongs. You cannot specify the SecurityGroupId and SecurityGroupIds properties at the same time.
SecurityGroupIds List No No The IDs of the security groups to which the new ECS instances belong.

For more information, see Security group limits

You cannot specify the SecurityGroupId and SecurityGroupIds properties at the same time.
InstanceName String No No The name of the new ECS instance. The name must be 128 characters in length, and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
Password String No Yes The password that is used to log on to the new ECS instance. The password must be 8 to 30 characters in length, and can contain letters, digits, and special characters. Special characters include: ( ) ‘ ~ ! @ # $ % ^ & ∗ - + = | { } [ ] : ; ’ < > , . ? / -.

If you specify this property, you must 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: uses the preset password.
  • false: does not use the preset password.
Note If you set this property to true, make sure that you leave the Password property empty and the image that you want to use has a preset password.
DiskMappings List No Yes The disks that you attach to the new ECS instance. You can attach up to 16 disks.

For more information, see DiskMappings properties.

Period Number No Yes The billing cycle of the new ECS instance. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36.

Unit: month.

This property is required if you set the InstanceChargeType property to PrePaid. This property is optional if you set the InstanceChargeType property to PostPaid.
Tags List No Yes The tags that you specify for the new 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.

ZoneId String No No The zone ID of the new ECS instance. None.
KeyPairName String No Yes The name of the key pair that is used to connect to the new ECS instance. For Windows ECS instance, you can ignore this property. The Password property takes effect for ECS instances even if you specify the KeyPairName property. For Linux ECS instances, password-based logon is disabled.
RamRoleName String No Yes The name of the RAM role for the new ECS instance. You can call the ListRoles operation to query the name of the RAM role. For more information, see CreateRole and ListRoles.
SpotPriceLimit String No No The maximum hourly price of the instance. The value of this property can contain up to three decimal places. This property takes effect when you set the SpotStrategy property to SpotWithPriceLimit.
SpotStrategy String No No The bidding policy for a pay-as-you-go instance. This property is required when you set the InstanceChargeType property to PostPaid.
Default value: NoSpot. Valid values:
  • NoSpot: The instance is created as a regular pay-as-you-go instance.
  • SpotWithPriceLimit: The instance is created as a preemptible instance for which you specify the maximum hourly price.
  • SpotAsPriceGo: The instance is created as a preemptible instance whose price is based on the market price at the time of purchase. The market price can be equal to the price of a pay-as-you-go instance.
SystemDiskDiskName String No Yes The name of the system disk. The name must be 2 to 128 characters in length, and can contain digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.
PeriodUnit String No Yes The unit of the billing cycle for the new ECS instance. Default value: Month. Valid values:
  • Week

    If you set this property to Week, valid values of the Period property are 1, 2, 3, and 4, and valid values of the AutoRenewPeriod property are 1, 2, and 3.

  • Month

    If you set this property to Month, valid values of the Period property are 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60, and valid values of the AutoRenewPeriod property are 1, 2, 3, 6, and 12.

AutoRenewPeriod Number No Yes The auto-renewal period for the new ECS instance. This property is required when you set the AutoRenew property to True.

Default value: 1. Valid values:

  • 1
  • 2
  • 3
  • 6
  • 12
AutoRenew String No Yes Specifies whether to enable auto-renewal for the new ECS instance. Default value: False. Valid values:
  • True: enables auto-renewal.
  • False: disables auto-renewal.
This property is required when you set the InstanceChargeType property to PrePaid.
EniMappings List No Yes The elastic network interfaces (ENIs) that you attach to the new ECS instance. You can attach only one ENI to each ECS instance.

For more information, see EniMappings properties

AutoReleaseTime String No No The time at which the system automatically releases the ECS instance. 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 instance is created.
SystemDiskCategory String No Yes The category of the system disk. Default value: cloud_efficiency. Valid values:
  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: SSD
  • cloud_essd: enhanced SSD (ESSD)
SystemDiskProvisionedIops Integer No Yes The IOPS that is preset in the system disk. None.
SystemDiskBurstingEnabled Boolean No Yes Specifies whether to enable the burst mode for the system disk. Default value: false. Valid values:
  • true: enables the burst mode.
  • false: disables the burst mode.
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.
LaunchTemplateId String No Yes The ID of the launch template. None.
SystemDiskDescription String No Yes The description of the system disk. None.
DeletionProtection Boolean No No Specifies whether to enable deletion protection to allow you to release the instance by using the ECS console or by calling the DeleteInstance operation. Valid values:
  • true: enables deletion protection.
  • false: does not enable deletion protection.
DeploymentSetId String No Yes The ID of the deployment set. None.
Ipv6AddressCount Integer No Yes The number of randomly generated IPv6 addresses that are assigned to the ENI. You cannot specify the Ipv6Addresses and Ipv6AddressCount properties at the same time.
Ipv6Addresses List No Yes The one or more IPv6 addresses that are assigned to the ENI. You can specify only one IPv6 address. If you modify this property, existing instances are not affected. You cannot specify the Ipv6Addresses and Ipv6AddressCount properties at the same time.
SystemDiskAutoSnapshotPolicyId String No Yes The ID of the automatic snapshot policy for the system disk. 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
  }
]

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. Default value: cloud. Valid values:
  • cloud: basic disk
  • cloud_ssd: SSD
  • cloud_essd: ESSD
  • cloud_efficiency: ultra disk
DiskName String No No The name of the data disk. The name can be up to 128 characters in length. The name can contain letters, digits, underscores (_), periods (.), and hyphens (-).
Description String No No The description of the data disk. The description must be 2 to 256 characters in length. The description cannot start with http:// or https://.
Device String No No The device name of the data disk that is attached to the new ECS instance. Example: /dev/xvd[a-z].
SnapshotId String No No The ID of the snapshot. None.
Encrypted String No No Specifies whether to encrypt the data disk. Default value: false. Valid values:
  • true: encrypts the data disk.
  • false: does not encrypt the data disk.
KMSKeyId String No No The ID of the Key Management Service (KMS) key that is used for the data disk. None.
AutoSnapshotPolicyId String No No The ID of the automatic snapshot policy. None.
PerformanceLevel String No No The performance level (PL) of the ESSD that is used as the system disk.

Default value: PL1. Valid values:

  • PL0: An ESSD delivers up to 10,000 random read/write IOPS.
  • PL1: An ESSD delivers up to 50,000 random read/write IOPS.
  • PL2: An ESSD delivers up to 100,000 random read/write IOPS.
  • PL3: An ESSD delivers up to 1,000,000 random read/write IOPS.
For more information about how to select the PLs of ESSDs, see ESSDs.
ProvisionedIops Integer No No The IOPS that is preset in the disk. None.
BurstingEnabled Boolean No No Specifies whether to enable the burst mode. Default value: false. Valid values:
  • true: enables the burst mode.
  • false: disables the burst mode.

EniMappings syntax

"EniMappings": [
  {
    "SecurityGroupId": String,
    "VSwitchId": String,
    "Description": String,
    "NetworkInterfaceName": String,
    "PrimaryIpAddress": String
  }
]

EniMappings properties

Property Type Required Editable Description Constraint
SecurityGroupId String Yes Yes The ID of the security group to which the ENI belongs. None.
VSwitchId String Yes No The ID of the vSwitch to which the ENI belongs. None.
Description String No Yes The description of the ENI. The description must be 2 to 256 characters in length. The description cannot start with http:// or https://.
NetworkInterfaceName String No Yes The name of the ENI. None.
PrimaryIpAddress String No No The primary IP address of the ENI. None.

Tags syntax

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

Tags properties

Property Type Required Editable Description Constraint
Key String Yes No The tag key. The key must be 1 to 128 characters in length, and cannot contain http:// or https://. The key cannot start with aliyun or acs:.
Value String No No The tag value. The value must be 0 to 128 characters in length, and cannot contain http:// or https://. The value cannot start with aliyun or acs:.

Return values

Fn::GetAtt

  • InstanceIds: the IDs of the new ECS instances. An instance ID is a globally unique identifier (GUID) that is generated by the system for an instance.
  • PrivateIps: the private IP addresses of new ECS instances in a virtual private cloud (VPC). This property takes effect when the NetworkType property is set to vpc. The value is a JSON array that can contain 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 private IP addresses of new ECS instances in the classic network. This property takes effect when the NetworkType property is set to classic. The value is a JSON array that can contain 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 public IP addresses of new ECS instances in the classic network. This property takes effect when the NetworkType property is set to classic. The value is a JSON array that can contain up to 100 IP addresses that are separated by commas (,). Example: ["42.1.XX.XX", "42.1.XX.XX", … "42.1.XX.XX"].
  • HostNames: the hostnames of all the new ECS instances.
  • OrderId: the order ID of the new ECS instances.
  • ZoneIds: the zone IDs of the new ECS instances.
  • Ipv6AddressIds: the IDs of IPv6 addresses of the new ECS instances. The IPv6 address IDs are returned in a list that has two levels of nesting. If none of the ECS instances have an IPv6 address, the element at the relevant position in the list is empty. If none of the ECS instances have an IP address, null is returned.
  • Ipv6Addresses: the IPv6 addresses of the new ECS instances. The IPv6 addresses are returned in a list that has two levels of nesting. If none of the ECS instances have an IPv6 address, the element at the relevant position in the list is empty. If none of the ECS instances have an IP address, null is returned.

Examples

JSON format

{
  "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": {
        "en": "The source ECS instance ID to be cloned",
         
      },
      "Label": {
         
        "en": "Source Instance ID"
      }
    },
    "InstanceName": {
      "Type": "String",
      "Description": {
        "en": "[2, 128] alphanumeric letters, underline, dot or hyphen",
          
      },
      "ConstraintDescription": {
        "en": "[2, 128] characters, consists of uppercase letter, lowercase letter, number or special characters.",
         
      },
      "Label": {
         
        "en": "Instance Name"
      },
      "Default": "ClonedECS",
      "MaxLength": 128,
      "MinLength": 2
    },
    "MaxAmount": {
      "Type": "Number",
      "Description": {
        "en": "The maximum of ECS instances, must be greater than or equal to the minimum.",
         
      },
      "ConstraintDescription": {
         
        "en": "An integer within [1, 100]"
      },
      "Label": {
         
        "en": "The Maximum of ECS Instances"
      },
      "MaxValue": 100,
      "MinValue": 1,
      "Default": 1
    },
    "Password": {
      "Type": "String",
      "Description": {
        "en": "[8, 30] characters, consists of uppercase letter, lowercase letter, number or special characters such as ( ) ` ~ !   / ",
              
      },
      "ConstraintDescription": {
        "en": "Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^*_-+=|{}[]:;',.?/",
          
      },
      "Label": {
         
        "en": "ECS Instance Password"
      },
      "MaxLength": 30,
      "MinLength": 8,
       
      "NoEcho": true
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "InstanceName",
            "SourceInstanceId",
            "MaxAmount",
            "Password"
          ],
          "Label": {
            "default": "ECS"
          }
        }
      ],
      "TemplateTags": [
         
      ]
    }
  },
  "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"
        ]
      }
    }
  }
}

To view more examples, visit InstanceGroup.json and InstanceGroup.yml. In the examples, the following resource types are used: ALIYUN::ECS::InstanceGroup, ALIYUN::ECS::InstanceClone, ALIYUN::ECS::Command, and ALIYUN::ECS::Invocation.