All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyReplaceSystemDiskInSLBVServerGroup

Last Updated:Nov 25, 2024

Template name

ACS-ECS-BulkyReplaceSystemDiskInSLBVServerGroup

Execute Now

Template description

Replaces the system disks of multiple Elastic Compute Service (ECS) instances in a vServer group of a Server Load Balancer (SLB) instance at a time.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

imageId

The ID of the source image.

String

Yes

VServerGroupId

The ID of the vServer group.

String

Yes

rateControl

The rate control settings.

Json

No

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

OOSAssumeRole

The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS).

String

No

""

Output parameters

Parameter

Description

Type

newSystemDiskIds

List

Permission policy that is required to execute the template

{
    "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"
        }
    ]
}

References

For more information, see ACS-ECS-BulkyReplaceSystemDiskInSLBVServerGroup.yml at GitHub.

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Bulky replaces system disk of ECS instances in Vserver group
  zh-cn: the description in Chinese
  name-en: ACS-ECS-BulkyReplaceSystemDiskWithSLBVServerGroup
  name-zh-cn: the description in Chinese
  categories:
    - slb_management
Parameters:
  imageId:
    Label:
      en: ImageId
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
  VServerGroupId:
    Label:
      en: VServerGroupId
      zh-cn: the description in Chinese
    Type: String
  rateControl:
    Label:
      en: RateControl
      zh-cn: the description in Chinese
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 1
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: the description in Chinese
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: describeVServerGroupAttribute
    Action: ACS::ExecuteApi
    Description:
      en: Views vserver group attribute
      zh-cn: the description in Chinese
    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: the description in Chinese
    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: the description in Chinese
            en: Configure Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: the description in Chinese
            en: Control