All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::InstanceClone

Last Updated:Apr 24, 2024

ALIYUN::ECS::InstanceClone is used to clone an Elastic Compute Service (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,
    "UniqueSuffix": Boolean,
    "NetworkOptions": Map,
    "CpuOptions": Map,
    "NetworkInterfaceQueueNumber": Integer,
    "HostNames": List,
    "ImageOptions": Map,
    "SecurityOptions": Map
  }
}

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.

SourceInstanceId

String

Yes

No

The ID of the source ECS instance.

You can clone all data and settings of 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.

BackendServerWeight

Integer

No

No

The weight of the new ECS instance that you want to attach to 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 want to attach the new ECS instance.

None.

Description

String

No

No

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 you want to use to start the new ECS instance. You can use a public image, a custom image, or an Alibaba Cloud Marketplace image.

To specify a public image, you can enter a partial image ID instead of the complete image ID. Public images support fuzzy search. Examples:

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

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

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

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

SecurityGroupId

String

No

No

The ID of the security group to which the new ECS instance belongs.

None.

InstanceName

String

No

Yes

The name of the new ECS instance.

The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

Password

String

No

No

The password of the new ECS instance.

The password must be 8 to 30 characters in length.

It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.

The following special characters are supported: ( ) ' ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ‘ < > , . ? /.

If you specify this property, you must call specific Resource Orchestration Service (ROS) API operations by using HTTPS to prevent the exposure of your password.

DiskMappings

List

No

Yes

The disks that you want to attach to the new ECS instance.

You can attach up to 16 disks.

For more information, see DiskMappings properties.

Tags

List

No

Yes

The tags that you want to add to the new ECS instance.

You can add 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.

InstanceChargeType

String

No

No

The billing method of the new ECS instance.

Valid values:

  • PrePaid: subscription

    Note

    If you set this property to PrePaid, make sure that your account has sufficient balance. If your account has insufficient balance, the instance fails to be created.

  • PostPaid (default): pay-as-you-go

Period

Number

No

No

The subscription duration 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 InstanceChargeType to PrePaid. This property is optional if you set InstanceChargeType to PostPaid.

KeyPairName

String

No

Yes

The name of the key pair that you want to use to connect to the new ECS instance.

For Windows instances, the KeyPairName property is empty by default.

For Linux instances, the Password property takes effect even if you specify the KeyPairName property. However, password-based logons are disabled by default, and the value of the KeyPairName property is used to verify logons.

RamRoleName

String

No

No

The name of the Resource Access Management (RAM) role for the ECS instance.

For more information, see CreateRole and ListRoles.

SpotPriceLimit

String

No

No

The maximum hourly price of the new ECS instance.

The value of this property can contain up to three decimal places. This property takes effect when SpotStrategy is set to SpotWithPriceLimit.

SpotStrategy

String

No

No

The bidding policy for the pay-as-you-go instance.

This property takes effect when InstanceChargeType is set to PostPaid. Valid values:

  • NoSpot (default): The instance is created as a regular pay-as-you-go instance.

  • SpotWithPriceLimit: The instance is created as a preemptible instance that has a user-defined maximum hourly price.

  • SpotAsPriceGo: The instance is created as a preemptible instance whose bidding price is based on the market price at the time of purchase. The market price can be up to the pay-as-you-go price.

DeletionProtection

Boolean

No

No

The deletion protection property of the new ECS instance. You can use this property to specify whether you can delete the ECS instance in the ECS console or by calling the DeleteInstance operation.

Valid values:

  • true: You can delete the ECS instance in the ECS console or by calling the DeleteInstance operation.

  • false (default): You cannot delete the ECS instance in the ECS console or by calling the DeleteInstance operation.

InternetMaxBandwidthIn

Integer

No

No

The maximum outbound public bandwidth of the new ECS instance.

Unit: Mbit/s.  

Valid values: 0 to 200.

Default value: 200.  

UniqueSuffix

Boolean

No

No

Specifies whether to automatically append sequential suffixes to the HostName and InstanceName values when you create multiple instances.

The sequential suffixes range from 001 to 999.

Valid values:

  • true

  • false (default)

When you specify the HostName or InstanceName value in the name_prefix[begin_number,bits] format that does not contain a suffix specified by name_suffix, UniqueSuffix does not take effect. The names are sorted only in the specified sequence.

For more information, see Batch configure sequential names or hostnames for multiple instances.

NetworkOptions

Map

No

No

The network options of the new ECS instance.

For more information, see NetworkOptions property.

CpuOptions

Map

No

No

The CPU options of the new ECS instance.

For more information, see CpuOptions properties.

NetworkInterfaceQueueNumber

Integer

No

No

The number of queues supported by the primary elastic network interface (ENI) of the new ECS instance.

Take note of the following items:

  • The value of this property cannot exceed the maximum number of queues per ENI allowed for the instance type.

  • The total number of queues for all ENIs on an instance cannot exceed the queue quota for the instance type. To obtain the maximum number of queues per ENI for an instance type and the queue quota for the instance type, you can call the DescribeInstanceTypes operation and query the MaximumQueueNumberPerEni and TotalEniQueueQuantity values.

  • If NetworkInterface.N.InstanceType is set to Primary, you cannot specify NetworkInterfaceQueueNumber but can specify NetworkInterface.N.QueueNumber.

HostNames

List

No

No

The hostnames that you want to use for multiple instances.

None.

ImageOptions

Map

No

No

The image options of the new ECS instance.

For more information, see ImageOptions property.

SchedulerOptions

Map

No

No

The scheduling options of the new ECS instance.

For more information, see SchedulerOptions properties.

DiskMappings syntax

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

DiskMappings properties

Property

Type

Required

Editable

Description

Constraint

Size

String

Yes

No

The size of the data disk.

Valid values: 20 to 500.

Unit: GB.

Category

String

No

No

The category of the data disk.

Valid values:

  • cloud: basic disk

  • cloud_ssd: standard SSD

  • cloud_essd: enhanced SSD (ESSD)

  • cloud_efficiency: ultra disk

  • ephemeral_ssd: local SSD

For I/O optimized instances, the default value is cloud_efficiency. For non-I/O optimized instances, the default value 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 and cannot start with http:// or https://. It can contain letters, digits, underscores (_), colons (:), and hyphens (-).

PerformanceLevel

String

No

No

The performance level (PL) of the ESSD that you want to use as the system disk.

Valid values:

  • PL0: An ESSD delivers up to 10,000 random read/write IOPS.

  • PL1 (default): 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 PL of the ESSD, see ESSDs.

Description

String

No

No

The description.

The description must be 2 to 256 characters in length.

By default, this property is empty.

Device

String

No

No

The mount target.

This property will be removed. We recommend that you use other properties to improve code compatibility.

SnapshotId

String

No

No

The ID of the snapshot that you want to use to create the data disk.

None.

Tags syntax

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

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The tag value.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

NetworkOptions syntax

"NetworkOptions": {
  "EnableJumboFrame": Boolean
}

NetworkOptions property

Property

Type

Required

Editable

Description

Constraint

EnableJumboFrame

Boolean

No

No

Specifies whether to enable the jumbo frame feature for the instance.

Valid values:

  • false: does not enable the jumbo frame feature for the instance. The maximum transmission unit (MTU) value of all ENIs on the instance is set to 1500.

  • true: enables the jumbo frame feature for the instance. The MTU value of all ENIs on the instance is set to 8500.

Default value: true.

Note

The jumbo frame feature is supported only by specific instance types whose generations are later than the eighth generation. For more information, see MTUs.

CpuOptions syntax

"CpuOptions": {
  "ThreadsPerCore": Integer,
  "Core": Integer
}

CpuOptions properties

Property

Type

Required

Editable

Description

Constraint

ThreadsPerCore

Integer

No

No

The number of threads per core.

The number of vCPUs of an ECS instance is calculated based on the following formula: Number of vCPUs = CpuOptions.Core value × CpuOptions.ThreadsPerCore value.

Core

Integer

No

No

The number of physical CPU cores.

You cannot specify a custom value for this property. You must set this property to one of its default values.

For more information about the default values, see Specify and view CPU options.

ImageOptions syntax

"ImageOptions": {
  "LoginAsNonRoot": Boolean
}

ImageOptions property

Property

Type

Required

Editable

Description

Constraint

LoginAsNonRoot

Boolean

No

No

Specifies whether the instance that uses the image supports the logons of the ecs-user user.

Valid values:

  • true

  • false

SecurityOptions syntax

"SecurityOptions": {
  "TrustedSystemMode": String
}

SchedulerOptions properties

Property

Type

Required

Editable

Description

Constraint

DedicatedHostClusterId

String

No

No

The ID of the dedicated host cluster in which you want to create the instance. After you specify this property, the system selects one dedicated host from the specified cluster to create the instance.

Note

This property takes effect only when Tenancy is set to host.

When you specify both DedicatedHostId and SchedulerOptions.DedicatedHostClusterId, take note of the following items:

  • If the specified dedicated host belongs to the specified dedicated host cluster, the instance is preferentially deployed on the specified dedicated host.

  • If the specified dedicated host does not belong to the specified dedicated host cluster, the instance fails to be created.

You can call the DescribeDedicatedHostClusters operation to query the IDs of dedicated host clusters.

ManagedPrivateSpaceId

String

No

No

The ID of the managed private pool.

None.

Return values

Fn::GetAtt

  • InstanceId: the ID of the new ECS instance. The instance ID is a GUID that is generated by the system for an instance.

  • PrivateIp: the private IP address of the new ECS instance in a virtual private cloud (VPC). This property takes effect when NetworkType is set to vpc.

  • InnerIp: the private IP address of the new ECS instance in the classic network. This property takes effect when NetworkType is set to classic.

  • PublicIp: the public IP address of the new ECS instance in the classic network. This property takes effect when NetworkType is set to classic.

  • ZoneId: the zone ID of the new ECS instance.

  • HostName: the hostname of the new ECS instance.

  • PrimaryNetworkInterfaceId: the primary ENI ID of the new ECS instance.

  • SecurityGroupIds: the IDs of security groups to which the new ECS instance belongs.

  • RelatedOrderIds: the related order IDs of the new ECS instances.

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: SourceInstanceId

JSON 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"
        }
      }
    }
  }
}