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

CloudOps Orchestration Service:ACS-ECS-ModifyInstanceSpec

最終更新日:Jun 05, 2026

テンプレート名

ACS-ECS-ModifyInstanceSpec:従量課金インスタンスのインスタンスタイプを変更します。

[今すぐ実行]

説明

従量課金 ECS インスタンスのインスタンスタイプを変更します。

テンプレートタイプ

オートメーション

所有者

Alibaba Cloud

入力パラメーター

パラメーター名

説明

タイプ

必須

デフォルト値

制約

instanceId

ECS インスタンス ID。

String

はい

modifyInstanceSpecInfo

アップグレードまたはダウングレード時のインスタンスタイプマッピング。

Json

はい

regionId

リージョン ID。

String

いいえ

{{ ACS::RegionId }}

OOSAssumeRole

OOS が引き受ける RAM ロール。

String

いいえ

""

出力パラメーター

パラメーター名

説明

タイプ

instanceIdAndInstanceType

List

必要なアクセスポリシー

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

詳細

ACS-ECS-ModifyInstanceSpec の詳細

テンプレートコンテンツ:

FormatVersion: OOS-2019-06-01
Description:
  en: Modifies the instance type of a pay-as-you-go instance.
  zh-cn: Modifies the instance type of a pay-as-you-go instance.
  ja: 従量課金インスタンスのインスタンスタイプを変更します。
  name-en: ACS-ECS-ModifyInstanceSpec
  name-zh-cn: Modifies the instance type of a pay-as-you-go instance.
  name-ja: 従量課金インスタンスのインスタンスタイプの変更
  categories:
    - instance_manage
Parameters:
  regionId:
    Label:
      en: Region ID
      zh-cn: Region ID
      ja: リージョン ID
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceId:
    Label:
      en: ECS Instance ID
      zh-cn: ECS Instance ID
      ja: ECS インスタンス ID
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: regionId
  modifyInstanceSpecInfo:
    Description:
      en: 'upgrade:{"ecs.g6.large":"ecs.g6.xlarge", "ecs.g6.xlarge":"ecs.g6.2xlarge"} downgrade:{"ecs.g6.2xlarge":"ecs.g6.xlarge","ecs.g6.xlarge":"ecs.g6.large"}'
      zh-cn: |
        Upgrade format: {"ecs.g6.large":"ecs.g6.xlarge", "ecs.g6.xlarge":"ecs.g6.2xlarge"}
        Downgrade format: {"ecs.g6.2xlarge":"ecs.g6.xlarge", "ecs.g6.xlarge":"ecs.g6.large"}
      ja: |
        アップグレード形式:{"ecs.g6.large":"ecs.g6.xlarge", "ecs.g6.xlarge":"ecs.g6.2xlarge"}
        ダウングレード形式:{"ecs.g6.2xlarge":"ecs.g6.xlarge", "ecs.g6.xlarge":"ecs.g6.large"}
    Label:
      en: Instance Type Information
      zh-cn: The instance type information for upgrading or downgrading the instance.
      ja: インスタンスタイプ情報
    Type: Json
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role that OOS assumes.
      ja: OOS が引き受ける RAM ロール
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstanceType
    Action: 'ACS::ExecuteAPI'
    Description:
      en: Queries the instance type.
      zh-cn: Queries the instance type.
      ja: インスタンスタイプを照会します。
    Properties:
      Service: ECS
      API: DescribeInstances
      Parameters:
        RegionId: '{{ regionId }}'
        InstanceIds:
          - '{{ instanceId }}'
    Outputs:
      instanceType:
        Type: String
        ValueSelector: Instances.Instance[].InstanceType
      instanceIds:
        Type: List
        ValueSelector: Instances.Instance[].InstanceId
  - Name: checkForWhetherResourceExist
    Action: ACS::Choice
    Description:
      en: Checks whether the resource exists.
      zh-cn: Checks whether the resource exists.
      ja: リソースが存在するかどうかを確認します。
    Properties:
      DefaultTask: checkForInstanceTypeAvailable
      Choices:
        - When:
            Fn::Equals:
              - []
              - '{{ getInstanceType.instanceIds }}'
          NextTask: ACS::END
  - Name: checkForInstanceTypeAvailable
    Action: ACS::CheckFor
    Description:
      en: Checks whether the instance type is available.
      zh-cn: Checks whether the instance type is available.
      ja: インスタンスタイプが利用可能かどうかを確認します。
    Properties:
      Service: ECS
      API: DescribeInstanceTypes
      Parameters:
        RegionId: '{{ regionId }}'
        InstanceTypes:
          - Fn::Select:
              - '{{ getInstanceType.instanceType }}'
              - '{{ modifyInstanceSpecInfo }}'
      NotDesiredValues:
        - []
      PropertySelector: InstanceTypes.InstanceType
  - Name: ModifyInstanceSpec
    Action: 'ACS::ECS::ModifyInstanceSpec'
    Description:
      en: Modifies the instance type.
      zh-cn: Modifies the instance type.
      ja: インスタンスタイプを変更します。
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ instanceId }}'
      instanceType:
        'Fn::Select':
          - '{{ getInstanceType.instanceType }}'
          - '{{ modifyInstanceSpecInfo }}'
  - Name: describeInstances
    Action: 'ACS::ExecuteAPI'
    Description:
      en: Queries information about the ECS instances.
      zh-cn: Queries information about the ECS instances.
      ja: ECS インスタンスに関する情報を照会します。
    Properties:
      Service: ECS
      API: DescribeInstances
      Parameters:
        RegionId: '{{ regionId }}'
        InstanceIds:
          - '{{ instanceId }}'
    Outputs:
      instanceIdAndInstanceType:
        Type: List
        ValueSelector: 'Instances.Instance[] | {"InstanceId": .InstanceId, "InstanceType" : .InstanceType}'
Outputs:
  instanceIdAndInstanceType:
    Type: List
    Value: '{{ describeInstances.instanceIdAndInstanceType }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - modifyInstanceSpecInfo
        Label:
          default:
            zh-cn: Configure Parameters
            en: Configure Parameters
            ja: パラメーターの設定
      - Parameters:
          - regionId
          - instanceId
        Label:
          default:
            zh-cn: Select Instances
            en: Select Instances
            ja: インスタンスの選択
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Advanced Options
            ja: 詳細オプション