ALIYUN::ECS::InstanceClone is used to clone an ECS instance.

Syntax

{
  "Type": "ALIYUN::ECS::InstanceClone",
  "Properties": {
    "DeletionProtection": Boolean,
    "DiskMappings": List,
    "LoadBalancerIdToAttach": String,
    "Description": String,
    "BackendServerWeight": Integer,
    "Tags": List,
    "SecurityGroupId": String,
    "RamRoleName": String,
    "ImageId": String,
    "ResourceGroupId": String,
    "SpotPriceLimit": String,
    "InstanceChargeType": String,
    "SourceInstanceId": String,
    "Period": Number,
    "SpotStrategy": String,
    "Password": String,
    "InstanceName": String,
    "InternetMaxBandwidthIn": Integer,
    "ZoneId": String,
    "KeyPairName": String
  }
}

Properties

Name Type Required Editable Description Validity
ResourceGroupId String No No The ID of the resource group to which the instance belongs. None
SourceInstanceId String Yes No The ID of the ECS instance to be cloned. The clone operation clones the specified instance, including its instance type, image, bandwidth billing method, bandwidth limit, and network type. If the source ECS instance belongs to multiple security groups, the cloned instance is added only to the first of these security groups.
BackendServerWeight Integer No No The weight assigned to the ECS instance in the SLB instance. Valid values: 0 to 100. Default value: 100.
LoadBalancerIdToAttach String No No The ID of the SLB instance to which the ECS instance is to be attached. None
Description String No No The description of the ECS instance. The description can be up to 256 characters in length.
ImageId String No Yes The ID of the image used to start the ECS instance. You can use a public image, a custom image, or an Alibaba Cloud Marketplace image. For more information, see Public images for ECS instances.

When editing a template, you can specify the image type and version or only the image type. ROS automatically selects an appropriate public image ID.

You can use the wildcard character (*) to represent part of an image ID.

Take all Ubuntu public images provided by Alibaba Cloud as an example. You can use one of the following methods to specify the public image ID for the ECS instance:

If you enter ubuntu, the system matches it with the following ID: ubuntu16_0402_64_20G_alibase_20170818.vhd

If you enter ubuntu_14, the system matches it with the following ID: ubuntu_14_0405_64_20G_alibase_20170824.vhd

If you enter ubuntu*14*32, the system matches it with the following ID: ubuntu_14_0405_32_40G_alibase_20170711.vhd

If you enter ubuntu_16_0402_32, the system matches it with the following ID: ubuntu_16_0402_32_40G_alibase_20170711.vhd

SecurityGroupId String No No The ID of the security group to which the created instance belongs. None
InstanceName String No No The name of the instance. The name can be up to 128 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
Password String No No The password used to log on to the ECS instance.

The password must be 8 to 30 characters in length and must contain letters, digits, and special characters.

Special characters include ( ) ' ~ ! @ # $ % ^ & * - + = | { } [ ] : ; < > , . ? /

If you specify the Password parameter in the API request, use HTTPS to secure the API and protect your password.

DiskMappings List No No The list of disks to be attached to the ECS instance. A maximum of 16 data disks can be attached.
Tags List No No The custom tags of the ECS instance. A maximum of 20 tags can be specified in the [{"Key":"tagKey","Value":"tagValue"},{"Key":"tagKey2","Value":"tagValue2"}] format.
ZoneId String No No The ID of the zone where the ECS instance resides. None
InstanceChargeType String No No The billing method of the ECS instance.

Valid values: Prepaid and Postpaid.

Default value: Postpaid. If you set this parameter to Prepaid, make sure that you have sufficient balance in your account. Otherwise, the instance fails to be created.

Period Number No No The billing cycle for the ECS instance. This parameter is required when the InstanceChargeType parameter is set to Prepaid. This parameter is ignored when the InstanceChargeType parameter is set to Postpaid. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36. Unit: months.
KeyPairName String No No The name of the key pair that is used to connect to the ECS instance.

For Windows-based instances, this parameter is empty by default.

For Linux-based ECS instances, the Password parameter still takes effect if this parameter is specified. However, logon by password is disabled, and the KeyPairName value is used.

RamRoleName String No No The RAM role name of the ECS instance. You can call the ListRoles operation to query the role name. For more information, see CreateRole and ListRoles. None
SpotPriceLimit String No No The maximum hourly price of the ECS instance. This parameter takes effect only when the SpotStrategy parameter is set to SpotWithPriceLimit. Three decimal places are allowed at most.
SpotStrategy String No No The bidding policy for the pay-as-you-go instance. This parameter takes effect only when the InstanceChargeType parameter is set to PostPaid. Valid values:

NoSpot: applies to regular pay-as-you-go instances.

SpotWithPriceLimit: applies to preemptible instances with a maximum hourly price.

SpotAsPriceGo: applies to pay-as-you-go instances priced at the market price at the time of purchase.

Default value: NoSpot.

InternetMaxBandwidthIn Integer No No The maximum bandwidth of the inbound traffic from the Internet. Unit: Mbit/s. Valid values: 1 to 200.
DeletionProtection Boolean No No The release protection property of the ECS instance. It specifies whether the instance can be released from the ECS console or through the DeleteInstance operation. Valid values: true and false.

DiskMappings syntax

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

DiskMappings properties

Name Type Required Editable Description Validity
Size String Yes No The size of the data disk. Unit: GB. None
Category String No No The type of the data disk.

Valid values: cloud, cloud_efficiency, cloud_ssd, and ephemeral_ssd.

Default value: cloud.

DiskName String No No The name of the data disk. The name can be up to 128 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
Description String No No The description of the data disk. The description must be 2 to 256 characters in length. This parameter is empty by default.
Device String No No The device name of the data disk. If you do not specify this parameter, the system automatically allocates a device name in alphabetical order from /dev/xvdb to /dev/xvdz.
SnapshotId String No No The ID of the snapshot used to create the data disk. None

Tags syntax

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

Tags properties

Name Type Required Editable Description Validity
Key String Yes No The key of the tag. It cannot be an empty string. The key can be up to 64 characters in length. It cannot start with aliyun or acs: and cannot contain http:// or https://. None
Value String No No The value of the tag. The value can be up to 128 characters in length. It cannot start with aliyun or acs: and cannot contain http:// or https://. None

Response parameters

Fn::GetAtt

  • InstanceId: the ID of the instance. The instance ID is a globally unique identifier (GUID) generated by the system for the instance.
  • PrivateIp: the private IP address of the instance in a VPC. This parameter takes effect only when the NetworkType parameter is set to VPC.
  • InnerIp: the private IP address of the instance in a classic network. This parameter takes effect only when the NetworkType parameter is set to Classic.
  • PublicIp: the public IP address of the instance in a classic network. This parameter takes effect only when the NetworkType parameter is set to Classic.
  • ZoneId: the ID of the zone where the instance resides.
  • HostName: the hostname of the instance.

Examples

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "WebServer": {
      "Type": "ALIYUN::ECS::InstanceClone",
      "Properties": {
        "SourceInstanceId": "i-25zsk****",
        "SecurityGroupId": "sg-25zwc****",
        "ZoneId": "cn-beijing-b",
        "DiskMappings": [
            {"Size": 10, "Category": "cloud"},
            {"Size": 10, "Category": "cloud", "SnapshotId": "s-25wsw****"}
        ]
      }
    }
  },
  "Outputs": {
    "InstanceId": {
         "Value": {"get_attr": ["WebServer","InstanceId"]}
    },
    "PublicIp": {
         "Value": {"get_attr": ["WebServer","PublicIp"]}
    }
  }
}