ACS-ECS-BulkyReplaceSystemDiskInSLBVServerGroup

模板名称

ACS-ECS-BulkyReplaceSystemDiskInSLBVServerGroup 批量替换SLB虚拟服务组内ECS实例的系统盘

立即执行

模板描述

批量替换SLB虚拟服务组内ECS实例的系统盘

模板类型

自动化

所有者

Alibaba Cloud

输入参数

参数名称

描述

类型

是否必填

默认值

约束

imageId

源镜像ID

String

VServerGroupId

服务器组ID

String

rateControl

任务执行的并发比率

Json

{‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 1}

OOSAssumeRole

OOS扮演的RAM角色

String

“”

输出参数

参数名称

描述

类型

newSystemDiskIds

List

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

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "slb:DescribeVServerGroupAttribute",
                "slb:SetVServerGroupAttribute"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ecs:DescribeDisks",
                "ecs:DescribeInstances",
                "ecs:ReplaceSystemDisk",
                "ecs:StartInstance",
                "ecs:StopInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

详情

ACS-ECS-BulkyReplaceSystemDiskInSLBVServerGroup详情

模板内容

FormatVersion: OOS-2019-06-01
Description:
  en: Bulky replaces system disk of ECS instances in Vserver group
  zh-cn: 批量替换SLB虚拟服务组内ECS实例的系统盘
  name-en: ACS-ECS-BulkyReplaceSystemDiskWithSLBVServerGroup
  name-zh-cn: 批量替换SLB虚拟服务组内ECS实例的系统盘
  categories:
    - slb_management
Parameters:
  imageId:
    Label:
      en: ImageId
      zh-cn: 源镜像ID
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
  VServerGroupId:
    Label:
      en: VServerGroupId
      zh-cn: 服务器组ID
    Type: String
  rateControl:
    Label:
      en: RateControl
      zh-cn: 任务执行的并发比率
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 1
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: describeVServerGroupAttribute
    Action: ACS::ExecuteApi
    Description:
      en: Views vserver group attribute
      zh-cn: 获取服务组属性
    Properties:
      Service: SLB
      API: DescribeVServerGroupAttribute
      Parameters:
        VServerGroupId: '{{ VServerGroupId }}'
    Outputs:
      BackendServers:
        Type: List
        ValueSelector: BackendServers.BackendServer[]
  - Name: replaceSystemDisk
    Action: ACS::ECS::ElegantReplaceSystemDiskInSLBVServerGroup
    Description:
      en: Replaces the system disk of ECS instances
      zh-cn: 更换系统盘
    Properties:
      VServerGroupId: '{{ vServerGroupId }}'
      imageId: '{{ imageId }}'
      serverId:
        'Fn::Select':
          - ServerId
          - '{{ ACS::TaskLoopItem }}'
      weight:
        'Fn::Select':
          - Weight
          - '{{ ACS::TaskLoopItem }}'
      type:
        'Fn::Select':
          - Type
          - '{{ ACS::TaskLoopItem }}'
      port:
        'Fn::Select':
          - Port
          - '{{ ACS::TaskLoopItem }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ describeVServerGroupAttribute.BackendServers }}'
      Outputs:
        newSystemDiskIds:
          AggregateType: Fn::ListJoin
          AggregateField: newSystemDiskId
    Outputs:
      newSystemDiskId:
        Type: String
        ValueSelector: newSystemDiskId
Outputs:
  newSystemDiskIds:
    Type: List
    Value: '{{ replaceSystemDisk.newSystemDiskIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - imageId
          - VServerGroupId
        Label:
          default:
            zh-cn: 设置参数
            en: Configure Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 高级选项
            en: Control