All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-ModifyInstanceSpec

Last Updated:Jun 05, 2026

Nama templat

ACS-ECS-ModifyInstanceSpec: Mengubah tipe instans dari instans pay-as-you-go.

Execute Now

Deskripsi

Mengubah tipe instans dari instans ECS pay-as-you-go.

Jenis templat

Automation

Pemilik

Alibaba Cloud

Parameter input

Nama parameter

Deskripsi

Tipe

Wajib

Nilai default

Batasan

instanceId

ID instans ECS.

String

Ya

modifyInstanceSpecInfo

Pemetaan tipe instans untuk upgrade atau downgrade.

Json

Ya

regionId

ID wilayah.

String

Tidak

{{ ACS::RegionId }}

OOSAssumeRole

Peran RAM yang diasumsikan oleh OOS.

String

Tidak

“”

Parameter output

Nama parameter

Deskripsi

Tipe

instanceIdAndInstanceType

List

Kebijakan akses yang diperlukan

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

Detail

Detail ACS-ECS-ModifyInstanceSpec

Konten templat

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.
  name-en: ACS-ECS-ModifyInstanceSpec
  name-zh-cn: Modifies the instance type of a pay-as-you-go instance.
  categories:
    - instance_manage
Parameters:
  regionId:
    Label:
      en: Region ID
      zh-cn: Region ID
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  instanceId:
    Label:
      en: ECS Instance ID
      zh-cn: ECS Instance 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"}
    Label:
      en: Instance Type Information
      zh-cn: The instance type information for upgrading or downgrading the instance.
    Type: Json
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role that OOS assumes.
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstanceType
    Action: 'ACS::ExecuteAPI'
    Description:
      en: Queries the instance type.
      zh-cn: Queries the instance type.
    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.
    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.
    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.
    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.
    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
      - Parameters:
          - regionId
          - instanceId
        Label:
          default:
            zh-cn: Select Instances
            en: Select Instances
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Advanced Options