すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:ACS-ECS-システムディスクの一括交換

最終更新日:Jan 17, 2025

テンプレート名

ACS-ECS-システムディスクの一括交換

今すぐ実行

テンプレートの説明

複数のElastic Compute Service(ECS)インスタンスのシステムディスクを一度に交換します。 これは、システムの更新や障害の発見など、複数の ECS インスタンスのシステムディスクを交換する必要があるシナリオに適用されます。 このテンプレートを構成する際には、次のパラメーターを指定する必要があります。regionId:ECS インスタンスのリージョン、imageId:システムディスクの交換に使用するシステムイメージ、targets:ECS インスタンス。 テンプレートが実行されると、システムは新しいシステムディスクの ID を返します。

テンプレートの種類

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

種類

必須

デフォルト値

制限

imageId

イメージ ID。

String

はい

targets

システムディスクを交換する ECS インスタンス。

Json

はい

regionId

リージョン ID。

String

いいえ

{{ ACS::RegionId }}

password

ECS インスタンスへのアクセスに使用するユーザー名とパスワード。

String

いいえ

""

keyPairName

キーペアの名前。

String

いいえ

""

rateControl

レート制御設定。

Json

いいえ

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

OOSAssumeRole

CloudOps Orchestration Service(OOS)がアサインするResource Access Management(RAM)ロール。

String

いいえ

""

出力パラメーター

パラメーター

説明

種類

newSystemDiskIds

String

テンプレートの実行に必要な権限ポリシー

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

参照

詳細については、GitHub の AACS-ECS-BulkyReplaceSystemDisk.yml をご参照ください。

テンプレートコンテンツ

FormatVersion: OOS-2019-06-01
Description:
  en: 'Bulky replace the system disks of ECS instances, applicable to scenarios that require system disk replacement on multiple ECS instances, such as system upgrades and fault recovery. During configuration, users need to provide the following required parameter information: Region ID (regionId), which specifies the region of the ECS instances where the system disks will be replaced, Image ID (imageId), which specifies the image to use for the system disk replacement, and Target Instances (targets), which defines the specific ECS instances to be operated on. Upon execution, the template provides the IDs of the new system disks, enabling users to verify the status of the system disk replacements.'
  zh-cn: 中国語の説明
  name-en: ACS-ECS-BulkyReplaceSystemDisk
  name-zh-cn: 中国語の説明
  categories:
    - instance_manage
    - application_management
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: 中国語の説明
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  imageId:
    Label:
      en: ImageId
      zh-cn: 中国語の説明
    Description:
      en: <div style="color:#F00">If the system disk capacity of the image you select is larger than the original system disk capacity, the system disk will be automatically expanded, which may incur additional costs. </div>
      zh-cn: 中国語の説明</div>
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
    AssociationPropertyMetadata:
      RegionId: regionId
  password:
    Label:
      en: Password
      zh-cn: 中国語の説明
    Type: String
    Default: ''
  keyPairName:
    Label:
      en: KeyPairName
      zh-cn: 中国語の説明
    Type: String
    Default: ''
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: 中国語の説明
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  rateControl:
    Label:
      en: RateControl
      zh-cn: 中国語の説明
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: 中国語の説明
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: Views the ECS instances
      zh-cn: 中国語の説明
    Action: 'ACS::SelectTargets'
    Properties:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'
  - Name: replaceSystemDisk
    Action: 'ACS::ECS::ReplaceSystemDisk'
    Description:
      en: Replaces the system disk of ECS instances
      zh-cn: 中国語の説明
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
      imageId: '{{ imageId }}'
      keyPairName: '{{ keyPairName }}'
      password: '{{ password }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ getInstance.instanceIds }}'
      Outputs:
        newSystemDiskIds:
          AggregateType: 'Fn::ListJoin'
          AggregateField: newSystemDiskId
    Outputs:
      newSystemDiskId:
        Type: String
        ValueSelector: newSystemDiskId
Outputs:
  newSystemDiskIds:
    Type: String
    Value: '{{ replaceSystemDisk.newSystemDiskIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - imageId
          - password
          - keyPairName
        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: Control Options