The ALIYUN::ECS::InstanceClone type 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,
"ZoneId": String,
"KeyPairName": String,
"InternetMaxBandwidthIn": Integer
}
}Properties
Property name | Type | Required | Update allowed | Description | Constraints |
ResourceGroupId | String | No | No | The ID of the resource group to which the new instance belongs. | None |
SourceInstanceId | String | Yes | No | The ID of the source ECS instance to clone. | This clones all instance data and settings, such as 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 security group of the source instance. |
BackendServerWeight | Integer | No | No | The weight of the new 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 new ECS instance is to be added. | None |
Description | String | No | No | The description. | The description can be up to 256 characters in length. |
ImageId | String | No | Yes | The ID of the image used to start the new ECS instance. This can be a public image, custom image, or Alibaba Cloud Marketplace image. | You can specify a public image ID using a fuzzy match. You do not need to specify a complete public image ID. For example:
|
SecurityGroupId | String | No | No | The ID of the security group to which the new instance belongs. | None |
InstanceName | String | No | Yes | The name of the new instance. | The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character and cannot start with |
Password | String | No | No | The logon password for the new ECS instance. | The length must be between 8 and 30 characters. It must contain three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Supported special characters are: If you specify this parameter, you must call the API over HTTPS to prevent password leaks. |
DiskMappings | List | No | Yes | The disks to attach. | You can attach up to 16 disks. For more information, see DiskMappings properties. |
Tags | List | No | Yes | The custom tags. | You can add up to 20 tags. The format is: For more information, see Tags properties. |
ZoneId | String | No | No | The zone ID. | None |
InstanceChargeType | String | No | No | The billing method for the new instance. | Valid values:
|
Period | Number | No | No | The subscription period. | Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36. Unit: month. This parameter is required if InstanceChargeType is set to PrePaid. This parameter is optional if InstanceChargeType is set to PostPaid. |
KeyPairName | String | No | Yes | The name of the key pair to attach to the new ECS instance. | The default value for Windows is empty. For Linux, if you specify this parameter, the content of the Password parameter is still set for the instance, but password-based logon is disabled by default. Key pair authentication is used for logon. |
RamRoleName | String | No | No | The name of the instance RAM role for the new instance. | For more information, see Create a role and Get a list of roles. |
SpotPriceLimit | String | No | No | The maximum hourly price for the new instance. | This parameter supports up to three decimal places. It takes effect only when SpotStrategy is set to SpotWithPriceLimit. |
SpotStrategy | String | No | No | The bidding policy for the new pay-as-you-go instance. | This parameter takes effect only when InstanceChargeType is set to PostPaid. Valid values:
|
DeletionProtection | Boolean | No | No | The release protection attribute for the new instance. This specifies whether the instance can be released through the console or by calling the DeleteInstance operation. | Valid values:
|
InternetMaxBandwidthIn | Integer | No | No | Maximum outbound public network bandwidth | Unit: Mbit/s. Valid values: 0 to 200. Default value: 200. |
DiskMappings syntax
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Device": String,
"SnapshotId": String,
"PerformanceLevel": String,
"Size": String
}
]DiskMappings properties
Property Name | Type | Required | Update allowed | Description | Constraints |
Size | String | Yes | No | The size of the data disk. | Valid values: 20 to 500. Unit: GB. |
Category | String | No | No | The type of the data disk. | Valid values:
The default value for I/O optimized instances is cloud_efficiency. The default value for non-I/O optimized instances 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 or a Chinese character and cannot start with |
PerformanceLevel | String | No | No | When you create an enterprise SSD to use as a system disk, set the performance level of the disk. | Valid values:
For information about how to select an ESSD performance level, see Enterprise SSDs. |
Description | String | No | No | The description. | The length must be 2 to 256 characters. The default value is empty. |
Device | String | No | No | The mount target. | This parameter is being deprecated. To ensure compatibility, we recommend that you do not use this parameter. |
SnapshotId | String | No | No | The snapshot used to create the data disk. | None |
Tags syntax
"Tags": [
{
"Value": String,
"Key": String
}
]Tags properties
Property Name | Type | Required | Update allowed | Description | Constraints |
Key | String | Yes | No | The tag key. | The key must be 1 to 128 characters in length. It cannot start with |
Value | String | No | No | The tag value. | The value can be 0 to 128 characters in length. It cannot start with |
Return values
Fn::GetAtt
InstanceId: The ID of the new instance. This is a globally unique identifier generated by the system.
PrivateIp: The private IP address of the instance in a VPC. This attribute is returned only when NetworkType is set to
vpc.InnerIp: The private IP address of the instance in the classic network. This attribute is returned only when NetworkType is set to
classic.PublicIp: The public IP address of the instance in the classic network. This attribute is returned only when NetworkType is set to
classic.ZoneId: The ID of the zone.
HostName: The hostname of the instance.
PrimaryNetworkInterfaceId: The ID of the primary network interface controller (NIC).
SecurityGroupIds: A list of the IDs of the security groups to which the instance belongs.
Examples
YAML format
ROSTemplateFormatVersion: '2015-09-01'
Description: Test ECS Instance Clone
Parameters:
RegionId:
Type: String
AssociationProperty: ALIYUN::ECS::RegionId
SourceInstanceId:
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: ${RegionId}
Resources:
InstanceClone:
Type: ALIYUN::ECS::InstanceClone
Properties:
SourceInstanceId:
Ref: SourceInstanceIdJSON format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Test ECS Instance Clone",
"Parameters": {
"RegionId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::RegionId"
},
"SourceInstanceId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceId",
"AssociationPropertyMetadata": {
"RegionId": "${RegionId}"
}
}
},
"Resources": {
"InstanceClone": {
"Type": "ALIYUN::ECS::InstanceClone",
"Properties": {
"SourceInstanceId": {
"Ref": "SourceInstanceId"
}
}
}
}
}