All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-CloneInstancesAcrossAZ

Last Updated:Jun 22, 2026

Template name

ACS-ECS-CloneInstancesAcrossAZ: Clones one or more ECS instances to a different availability zone within the same region.

Execute now

Description

Clones one or more ECS instances to a different availability zone within the same region.

Template type

Automation

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default

Constraints

targets

The target instances.

Json

Yes

targetSecurityGroupId

The security group ID for the new instances.

String

Yes

targetVSwitchId

The vSwitch ID for the new instances. Determines the destination availability zone.

String

Yes

targetTags

The tags to add to the new instances.

Json

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

targetResourceGroupId

The resource group ID for the new instances.

String

No

targetInstanceType

The instance type of the new instances.

String

No

targetInstanceChargeType

The billing method for the new instances.

String

No

PostPaid

targetPeriodUnit

The subscription duration unit. Required only if the billing method is subscription (PrePaid).

String

No

targetPeriod

The subscription duration. Required only if the billing method is subscription (PrePaid).

Number

No

1

targetDeploymentSetId

The deployment set ID for the new instances.

String

No

targetInstanceName

The name of the new instances.

String

No

targetHostName

The hostname of the new instances.

String

No

rateControl

The concurrency and error tolerance for the loop task.

Json

No

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10}

OOSAssumeRole

The RAM role that CloudOps Orchestration Service (OOS) assumes.

String

No

""

Output parameters

Parameter

Description

Type

instanceIds

The IDs of the new instances.

List

Required permissions

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateImage",
                "ecs:DeleteImage",
                "ecs:DescribeAvailableResource",
                "ecs:DescribeDisks",
                "ecs:DescribeImages",
                "ecs:DescribeInstances",
                "ecs:DescribeVSwitches",
                "ecs:RunInstances"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Details

Details of ACS-ECS-CloneInstancesAcrossAZ

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Clones one or more ECS instances to a different availability zone within the same region.
  zh-cn: 跨可用区批量克隆ECS实例
  name-en: ACS-ECS-CloneInstancesAcrossAZ
  name-zh-cn: 跨可用区批量克隆ECS实例
  categories:
    - cross_region
Parameters:
  regionId:
    Type: String
    Label:
      en: Region ID
      zh-cn: 地域ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Label:
      en: Target instances
      zh-cn: 目标实例
    Type: Json
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  targetSecurityGroupId:
    Label:
      en: Target security group ID
      zh-cn: 新实例的安全组ID
    Type: String
    AssociationProperty: 'ALIYUN::ECS::SecurityGroup::SecurityGroupId'
    AssociationPropertyMetadata:
      RegionId: regionId
      Filters:
        - SecurityGroupId: targetSecurityGroupId
  targetVSwitchId:
    Label:
      en: Target vSwitch ID
      zh-cn: 新实例的交换机ID,填写本参数时将会决定目的可用区
    Type: String
    AssociationProperty: 'ALIYUN::VPC::VSwitch::VSwitchId'
    AssociationPropertyMetadata:
      RegionId: regionId
      Filters:
        - SecurityGroupId: targetSecurityGroupId
  targetResourceGroupId:
    Label:
      en: Target resource group ID
      zh-cn: 新实例将加入的目的资源组ID
    Type: String
    Default: ' '
  targetInstanceType:
    Label:
      en: Target instance type
      zh-cn: 新实例的规格
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
    AssociationPropertyMetadata:
      RegionId: regionId
    Default: ' '
  targetTags:
    Label:
      en: Target tags
      zh-cn: 新实例的标签
    Type: Json
    AssociationProperty: Tags
    AssociationPropertyMetadata:
      ShowSystem: false
  targetInstanceChargeType:
    Label:
      en: Billing method
      zh-cn: 新实例的付费模式,默认按量付费
    Type: String
    AllowedValues:
      - PrePaid
      - PostPaid
    Default: PostPaid
  targetPeriodUnit:
    Label:
      en: Subscription duration unit
      zh-cn: 当新实例的付费方式选择包年包月时,请在此处选择时长单位,默认单位是月
    Type: String
    AllowedValues:
      - Week
      - Month
      - ' '
    Default: ' '
  targetPeriod:
    Label:
      en: Subscription duration
      zh-cn: 当新实例的付费方式选择包年包月时,请在此处填写时长数,默认值为1
    Type: Number
    Default: 1
  targetDeploymentSetId:
    Label:
      en: Target deployment set ID
      zh-cn: 新实例的部署集ID
    Type: String
    Default: ' '
  targetInstanceName:
    Label:
      en: Instance name
      zh-cn: 新实例的名称
    Type: String
    Default: ' '
  targetHostName:
    Label:
      en: Hostname
      zh-cn: 新实例的主机名称
    Type: String
    Default: ' '
  rateControl:
    Label:
      en: Rate control
      zh-cn: 循环任务执行的并发率及容错数
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOS assume role
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: Gets the target ECS instances.
      zh-cn: 获取ECS实例
    Action: 'ACS::SelectTargets'
    Properties:
      RegionId: '{{regionId}}'
      ResourceType: 'ALIYUN::ECS::Instance'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'

  - Name: cloneInstancesAcrossAZ
    Action: 'ACS::Template'
    Description:
      en: Clones the instances.
      zh-cn: 克隆实例
    Properties:
      TemplateName: 'ACS::ECS::CloneInstanceAcrossAZ'
      Parameters:
        imageName: 'img-{{ ACS::TaskLoopItem }}-{{ACS::ExecutionId}}'
        instanceId: '{{ ACS::TaskLoopItem }}'
        targetSecurityGroupId: '{{ targetSecurityGroupId }}'
        targetResourceGroupId: '{{ targetResourceGroupId }}'
        targetVSwitchId: '{{ targetVSwitchId }}'
        regionId: '{{ regionId }}'
        targetInstanceName: '{{ targetInstanceName }}'
        targetInstanceChargeType: '{{ targetInstanceChargeType }}'
        targetPeriodUnit: '{{ targetPeriodUnit }}'
        targetPeriod: '{{ targetPeriod }}'
        targetInstanceType: '{{ targetInstanceType }}'
        targetHostName: '{{ targetHostName }}'
        targetDeploymentSetId: '{{ targetDeploymentSetId }}'
        tags: '{{ targetTags }}'
        OOSAssumeRole: '{{OOSAssumeRole}}'
    Loop:
      Items: '{{ getInstance.instanceIds }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        instanceIds:
          AggregateType: 'Fn::ListJoin'
          AggregateField: instanceId
    Outputs:
      instanceId:
        ValueSelector: instanceId
        Type: String
Outputs:
  instanceIds:
    Value: '{{ cloneInstancesAcrossAZ.instanceIds }}'
    Type: List
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - targetSecurityGroupId
          - targetVSwitchId
          - targetInstanceType
          - targetTags
          - targetInstanceChargeType
          - targetPeriodUnit
          - targetPeriod
          - targetResourceGroupId
          - targetDeploymentSetId
          - targetInstanceName
          - targetHostName
        Label:
          default:
            zh-cn: 设置参数
            en: Configure parameters
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: 选择实例
            en: Select ECS instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 高级选项
            en: Advanced options