全部产品
Search
文档中心

系统运维管理:ACS-ESS-RollingUpdateByUpdateContainerGroup

更新时间:Aug 20, 2026

模板名称

ACS-ESS-RollingUpdateByUpdateContainerGroup 通过更新容器组的方式滚动更新伸缩组内的ECI实例

立即执行

模板描述

通过更新容器组的方式滚动更新伸缩组内的ECI实例

模板类型

自动化

所有者

Alibaba Cloud

输入参数

参数名称

描述

类型

是否必填

默认值

约束

invokeType

操作类型

String

是

scalingGroupId

伸缩组ID

String

是

containerConfigure

用于更新的容器配置

Json

是

scalingConfigurationId

伸缩配置ID

String

是

enterProcess

执行开始要暂停的伸缩组流程

List

否

['ScaleIn', 'ScaleOut', 'HealthCheck', 'AlarmNotification', 'ScheduledAction']

exitProcess

执行结束要恢复的伸缩组流程

List

否

['ScaleIn', 'ScaleOut', 'HealthCheck', 'AlarmNotification', 'ScheduledAction']

sourceContainerConfigure

用于回滚的容器配置

Json

否

{}

updateType

Containers参数更新方式

String

否

IncrementalUpdate

sourceExecutionId

用于回滚的OOS执行ID

String

否

""

batchPauseOption

分批模式

String

否

Automatic

batchNumber

分批执行的批次

Number

否

5

maxErrors

分批执行的最大错误次数

Number

否

0

OOSAssumeRole

OOS扮演的RAM角色

String

否

""

输出参数

无

执行此模板需要的权限策略

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ess:DescribeScalingInstances",
                "ess:EnterStandby",
                "ess:ExitStandBy",
                "ess:ModifyEciScalingConfiguration",
                "ess:ResumeProcesses",
                "ess:SuspendProcesses"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "eci:DescribeContainerGroups",
                "eci:UpdateContainerGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:ListExecutions"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

详情

ACS-ESS-RollingUpdateByUpdateContainerGroup详情

模板内容

FormatVersion: OOS-2019-06-01
Description:
  en: Rolling update ECI instances in scaling group by update container group
  zh-cn: 通过更新容器组的方式滚动更新伸缩组内的ECI实例
  name-en: ACS-ESS-RollingUpdateByUpdateContainerGroup
  name-zh-cn: 通过更新容器组的方式滚动更新伸缩组内的ECI实例
  categories:
    - elastic_manage
Parameters:
  invokeType:
    Label:
      en: InvokeType
      zh-cn: 操作类型
    Type: String
    AllowedValues:
      - invoke
      - rollback
  scalingGroupId:
    Label:
      en: ScalingGroupId
      zh-cn: 伸缩组ID
    Type: String
  enterProcess:
    Label:
      en: EnterProcess
      zh-cn: 执行开始要暂停的伸缩组流程
    Type: List
    Default:
      - ScaleIn
      - ScaleOut
      - HealthCheck
      - AlarmNotification
      - ScheduledAction
  exitProcess:
    Label:
      en: ExitProcess
      zh-cn: 执行结束要恢复的伸缩组流程
    Type: List
    Default:
      - ScaleIn
      - ScaleOut
      - HealthCheck
      - AlarmNotification
      - ScheduledAction
  containerConfigure:
    Label:
      en: ContainerConfigure
      zh-cn: 用于更新的容器配置
    Type: Json
  sourceContainerConfigure:
    Label:
      en: SourceContainerConfigure
      zh-cn: 用于回滚的容器配置
    Type: Json
    Default: {}
  updateType:
    Label:
      en: ContainersUpdateType
      zh-cn: Containers参数更新方式
    Description:
      en: >-
        <ul class="ul">
          <li class="li">RenewUpdate: Full update, all related parameters need to be filled in when updating. If the parameter is a List, it does not support updating an item individually, and if the parameter is a structure, it does not support updating an internal member individually. </li>
          <li class="li">IncrementalUpdate: Incremental update, when updating, you can only fill in a parameter that needs to be updated, and other related parameters remain unchanged. </li>
        </ul>
      zh-cn: >-
        <ul class="ul">          
           <li class="li">RenewUpdate:全量更新,更新时需填写相关的所有参数。如果参数是一个List,不支持单独更新某个item,如果参数是一个结构体,不支持单独更新某个内部成员。</li>
           <li class="li">IncrementalUpdate:增量更新,更新时可以只填某一需要更新的参数,其它相关参数保持原有不变。</li>
        </ul>
    Type: String
    AllowedValues:
      - RenewUpdate
      - IncrementalUpdate
    Default: IncrementalUpdate
  sourceExecutionId:
    Label:
      en: SourceExecutionId
      zh-cn: 用于回滚的OOS执行ID
    Type: String
    Default: ''
  scalingConfigurationId:
    Label:
      en: ScalingConfigurationId
      zh-cn: 伸缩配置ID
    Type: String
  batchPauseOption:
    Label:
      en: BatchPauseOption
      zh-cn: 分批模式
    Type: String
    AllowedValues:
      - Automatic
      - FirstBatchPause
      - EveryBatchPause
    Default: Automatic
  batchNumber:
    Label:
      en: BatchNumber
      zh-cn: 分批执行的批次
    Type: Number
    MinValue: 1
    MaxValue: 100
    Default: 5
  maxErrors:
    Label:
      en: MaxErrors
      zh-cn: 分批执行的最大错误次数
    Type: Number
    Default: 0
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: choiceNextTask
    Action: ACS::Choice
    Description:
      en: Choose next task by invoke type
      zh-cn: 根据执行的类型选择执行的任务
    Properties:
      DefaultTask: getInstance
      Choices:
        - When:
            Fn::Equals:
              - rollback
              - '{{ invokeType }}'
          NextTask: getExecutionInstanceIds
  - Name: getInstance
    Description:
      en: Get the ECI instances
      zh-cn: 获取ECI实例
    Action: ACS::ExecuteApi
    Properties:
      Service: ESS
      API: DescribeScalingInstances
      Parameters:
        ScalingGroupId: '{{ scalingGroupId }}'
        LifecycleState: InService
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: ScalingInstances.ScalingInstance[].InstanceId
  - Name: whetherTheScalingGroupInstanceIsEmpty
    Action: ACS::Choice
    Description:
      en: Check whether the instance in the service in the scaling group is empty
      zh-cn: 检查伸缩组内服务中的实例是否为空
    Properties:
      DefaultTask: whetherToSuspendProcess
      Choices:
        - When:
            Fn::Equals:
              - []
              - '{{ getInstance.instanceIds }}'
          NextTask: modifyScalingConfigurationForInvoke
  - Name: whetherToSuspendProcess
    Action: ACS::Choice
    Description:
      en: Choose next task by process
      zh-cn: 根据流程值判断是否暂停流程
    Properties:
      DefaultTask: suspendProcess
      Choices:
        - When:
            Fn::Equals:
              - []
              - '{{ enterProcess }}'
          NextTask: invokeByUpdateContainerGroup
  - Name: suspendProcess
    Action: ACS::ExecuteAPI
    Description:
      en: Suspend process
      zh-cn: 暂停伸缩组流程
    Properties:
      Service: ESS
      API: SuspendProcesses
      Parameters:
        ScalingGroupId: '{{ scalingGroupId }}'
        Process: '{{ enterProcess }}'
  - Name: invokeByUpdateContainerGroup
    Action: ACS::ESS::UpdateContainerGroup
    Description:
      en: Update Container Group
      zh-cn: 更新容器组
    Properties:
      instanceId: '{{ ACS::TaskLoopItem }}'
      scalingGroupId: '{{ scalingGroupId }}'
      containerConfigure: '{{ containerConfigure }}'
      updateType: '{{ updateType }}'
    Loop:
      Items: '{{ getInstance.instanceIds }}'
      BatchPauseOption: '{{ batchPauseOption }}'
      Concurrency:
        Fn::CalculateBatch:
          - '{{ batchNumber }}'
          - '{{ getInstance.instanceIds }}'
  - Name: modifyScalingConfigurationForInvoke
    Action: ACS::ExecuteAPI
    Description:
      en: Modify scaling configuration for invoke
      zh-cn: 更新操作修改伸缩配置
    Properties:
      Service: ESS
      API: ModifyEciScalingConfiguration
      Parameters:
        ScalingConfigurationId: '{{ scalingConfigurationId }}'
        Container: '{{ containerConfigure }}'
        ContainersUpdateType: '{{ updateType }}'
  - Name: whetherToResumeProcessesByGroupInstances
    Action: ACS::Choice
    Description:
      en: Check whether the instance in the service in the scaling group is empty
      zh-cn: 检查伸缩组内服务中的实例是否为空
    Properties:
      DefaultTask: whetherToResumeProcesses
      Choices:
        - When:
            Fn::Equals:
              - []
              - '{{ getInstance.instanceIds }}'
          NextTask: ACS::END
  - Name: whetherToResumeProcesses
    Action: ACS::Choice
    Description:
      en: Choose next task by process
      zh-cn: 根据流程值判断是否恢复流程
    Properties:
      DefaultTask: resumeProcesses
      Choices:
        - When:
            Fn::Equals:
              - []
              - '{{ exitProcess }}'
          NextTask: ACS::END
  - Name: resumeProcesses
    Action: ACS::ExecuteAPI
    OnSuccess: ACS::END
    Description:
      en: Resume process
      zh-cn: 恢复伸缩组流程
    Properties:
      Service: ESS
      API: ResumeProcesses
      Parameters:
        ScalingGroupId: '{{ scalingGroupId }}'
        Process: '{{ exitProcess }}'
  - Name: getExecutionInstanceIds
    Action: ACS::ExecuteAPI
    Description:
      en: Get the instance id that has been updated
      zh-cn: 获取已经更新容器的实例ID
    Properties:
      Service: OOS
      API: ListExecutions
      Parameters:
        ParentExecutionId: '{{ sourceExecutionId }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: .Executions[].Parameters.instanceId
  - Name: getRollbackProcess
    Action: ACS::ExecuteAPI
    Description:
      en: Get resource parameters
      zh-cn: 获取源执行的参数
    Properties:
      Service: OOS
      API: ListExecutions
      Parameters:
        ExecutionId: '{{ sourceExecutionId }}'
    Outputs:
      enterProcess:
        Type: List
        ValueSelector: Executions[].Parameters.enterProcess[]
      exitProcess:
        Type: List
        ValueSelector: Executions[].Parameters.exitProcess[]
  - Name: suspendProcessWithRollBack
    Action: ACS::ExecuteAPI
    Description:
      en: Suspend process
      zh-cn: 暂停伸缩组流程
    Properties:
      Service: ESS
      API: SuspendProcesses
      Parameters:
        ScalingGroupId: '{{ scalingGroupId }}'
        Process: '{{ getRollbackProcess.enterProcess }}'
  - Name: rollbackByUpdateContainerGroup
    Action: ACS::ESS::UpdateContainerGroup
    Description:
      en: Update container group for rollback
      zh-cn: 回滚更新容器组
    Properties:
      instanceId: '{{ ACS::TaskLoopItem }}'
      scalingGroupId: '{{ scalingGroupId }}'
      containerConfigure: '{{ sourceContainerConfigure }}'
      updateType: '{{ updateType }}'
    Loop:
      Items: '{{ getExecutionInstanceIds.instanceIds }}'
      BatchPauseOption: '{{ batchPauseOption }}'
      Concurrency:
        Fn::CalculateBatch:
          - '{{ batchNumber }}'
          - '{{ getExecutionInstanceIds.instanceIds }}'
  - Name: modifyScalingConfigurationForRollback
    Action: ACS::ExecuteAPI
    Description:
      en: Modify scaling configuration for rollback
      zh-cn: 回滚操作修改伸缩配置
    Properties:
      Service: ESS
      API: ModifyEciScalingConfiguration
      Parameters:
        ScalingConfigurationId: '{{ scalingConfigurationId }}'
        Container: '{{ sourceContainerConfigure }}'
        ContainersUpdateType: '{{ updateType }}'
  - Name: whetherToResumeProcessesWithRollback
    Action: ACS::Choice
    Description:
      en: Choose next task by process
      zh-cn: 根据流程值判断是否恢复流程
    Properties:
      DefaultTask: resumeProcessesWithRollback
      Choices:
        - When:
            Fn::Equals:
              - []
              - '{{ getRollbackProcess.exitProcess }}'
          NextTask: ACS::END
  - Name: resumeProcessesWithRollback
    Action: ACS::ExecuteAPI
    Description:
      en: Resume process
      zh-cn: 恢复伸缩组流程
    Properties:
      Service: ESS
      API: ResumeProcesses
      Parameters:
        ScalingGroupId: '{{ scalingGroupId }}'
        Process: '{{ getRollbackProcess.exitProcess }}'