edit-icon download-icon

ALIYUN::ECS::InstanceClone

Last Updated: Jun 13, 2018

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

Syntax

  1. {
  2. "Type" : "ALIYUN::ECS::InstanceClone",
  3. "Properties" : {
  4. "SourceInstanceId" : String,
  5. "BackendServerWeight" : String,
  6. "LoadBalancerIdToAttach" : String,
  7. "SecurityGroupId" : String,
  8. "ImageId" : String,
  9. "InstanceName" : String,
  10. "Description" : String,
  11. "Password" : String,
  12. "ZoneId" : String,
  13. "DiskMappings" : List,
  14. "Tags" : String,
  15. "KeyPairName": String
  16. }
  17. }

Properties

Name Type Required Update allowed Description Constraint
SourceInstanceId string Yes No ID of the ECS instance you want to clone. The clone operation clones the instance type, image, bandwidth billing method, bandwidth limit, and network type. If the source ECS instance is added to multiple security groups, the new instance is added to the first of these security groups.
BackendServerWeight string No No Weight of the ECS instance in the Server Load Balancer instance. Value range: [0, 100]; default value: 100.
LoadBalancerIdToAttach string No No ID of the Server Load Balancer instance to which the ECS instance is added. None.
Description string No No Description. The maximum length is 256 characters.
ImageId string No Yes ID of the image used to start the ECS instance. The image can be a public image, custom image, or marketplace image.
ECS public image list
Specify a public image ID in a fuzzy manner, not a complete public image ID. Generally, to deploy an ECS instance, select the image type and version. You can specify the image type and version or specify the image type in the template. ROS automatically selects a proper public image ID. In the image ID for fuzzy search, you can replace some part of the image ID with the wildcard character asterisk (*).
Take all Ubuntu public images provided in Alibaba Cloud as an example:
ubuntu14_0405_32_40G_alibase_20170711.vhd.
ubuntu_14_0405_32_40G_alibase_20170711.vhd.
ubuntu_14_0405_64_20G_alibase_20170824.vhd.
ubuntu_16_0402_32_40G_alibase_20170711.vhd.
ubuntu_16_0402_64_20G_alibase_20170818.vhd.
To specify the public image ID for ECS, follow the subsequent methods:
Specify: ubuntu
Match: ubuntu_16_0402_64_20G_alibase_20170818.vhd.
Specify: ubuntu_14
Match: ubuntu_14_0405_64_20G_alibase_20170824.vhd.
Specify: ubuntu1432
Match: ubuntu_14_0405_32_40G_alibase_20170711.vhd.
Specify: ubuntu_16_0402_32
Match: ubuntu_16_0402_32_40G_alibase_20170711.vhd.
SecurityGroupId string No No ID of the security group to which the created instance belongs. None.
InstanceName string No No Instance name. The data disk name can contain a maximum of 128 characters including English letters, numbers, underscores(_), periods(.), and hyphens(-).
Password string No No ECS instance logon password. The password is a string of 8-30 characters and must contain uppercase/lowercase letters, numbers, and special characters including ( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ‘ < > , . ? /. If the Password parameter is required, HTTPS must be used when calling the API to prevent password leakage.
DiskMappings list No No Disk you want to attach. Up to four disks can be attached.
Tags list No No Custom tag. Up to four tags are supported, in the format of [{“Key”:”tagKey”,”Value”:”tagValue”},{“Key”:”tagKey2”,”Value”:”tagValue2”}].
ZoneId string No No Zone ID. None.
InstanceChargeType string No No Method of payment for the ECS instance, which can be Pay-As-You-Go or Subcription. Value options: Prepaid and Postpaid. Default value: Postpaid. If this parameter is set to Prepaid, make sure you have sufficient balance in your account; otherwise, instance creation will fail.
Period string No No Payment cycle. This parameter must be set when InstanceChargeType is Prepaid. When InstanceChargeType is Postpaid, this parameter is ignored. Value options: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36. unit: month.
KeyPairNamestringNoNo Name of the key pair bound to the ECS instance. This parameter is ignored if the key pair is bound to an ECS instance in Windows system. It is null by default. If this parameter is set, the value of the Password parameter is set to the instance, however, the password logon mode in Linux gets disabled. None.

DiskMappings syntax

  1. "DiskMappings" : [
  2. {
  3. "Category" : String,
  4. "DiskName" : String,
  5. "Description" : String,
  6. "Device" : String,
  7. "SnapshotId" : String,
  8. "Size" : String
  9. }
  10. ]

DiskMappings attributes

Name Type Required Update allowed Description Constraint
Size string Yes No Data disk size, in GB. None.
Category string No No Data disk type. Value options: cloud, cloudefficiency, cloud_ssd, and ephemeral_ssdDefault.
DiskName string No No Data disk name. The data disk name can contain a maximum of 128 characters including English letters, numbers, underscores(_), periods(.), and hyphens(-).
Description string No No Description. Value range: [2, 256]; default value: null.
Device string No No The address to which the data disk is attached in the ECS instance. Example: /dev/xvd[a-z].
SnapshotId string No No ID of the snapshot used to create the data disk. None.

Tags syntax

  1. "Tags" : [
  2. {
  3. "Value" : String,
  4. "Key" : String
  5. }
  6. ]

Tags attributes

Name Type Required Update allowed
Key string Yes No
Value string No No

Return values

Fn::GetAtt

  • InstanceId: ID of the instance, which is generated by the system and globally unique. It is a unique identifier of the instance.

  • PrivateIp: private IP address of a VPC type instance. This parameter is effective when NetworkType is VPC.

  • InnerIp: private IP address of a Classic type instance. This parameter is effective when NetworkType is Classic.

  • PublicIp: public IP address of a Classic type instance.

  • ZoneId: zone ID.

Example

  1. {
  2. "ROSTemplateFormatVersion" : "2015-09-01",
  3. "Resources" : {
  4. "WebServer": {
  5. "Type": "ALIYUN::ECS::InstanceClone",
  6. "Properties": {
  7. "SourceInstanceId": "i-25zskuabf",
  8. "SecurityGroupId": "sg-25zwc3se0",
  9. "ZoneId": "cn-beijing-b",
  10. "DiskMappings": [
  11. {"Size": 10, "Category": "cloud"},
  12. {"Size": 10, "Category": "cloud", "SnapshotId": "s-25wswg546"}
  13. ]
  14. }
  15. }
  16. },
  17. "Outputs": {
  18. "InstanceId": {
  19. "Value" : {"get_attr": ["WebServer","InstanceId"]}
  20. },
  21. "PublicIp": {
  22. "Value" : {"get_attr": ["WebServer","PublicIp"]}
  23. }
  24. }
  25. }
Thank you! We've received your feedback.