Todos os produtos
Search
Central de documentação

CloudOps Orchestration Service:ACS-ECS-ModifyInstanceSpec

Última atualização: Jun 28, 2026

Nome do modelo

ACS-ECS-ModifyInstanceSpec: Modifica o tipo de uma instância com pagamento conforme o uso.

Executar agora

Descrição

Modifique o tipo de uma instância ECS com pagamento conforme o uso.

Tipo de modelo

Automation

Proprietário

Alibaba Cloud

Parâmetros de entrada

Nome do parâmetro

Descrição

Tipo

Obrigatório

Valor padrão

Restrição

instanceId

ID da instância ECS.

String

Sim

modifyInstanceSpecInfo

Mapeamento de tipos de instância para upgrade ou downgrade.

Json

Sim

regionId

ID da região.

String

Não

{{ ACS::RegionId }}

OOSAssumeRole

Função RAM assumida pelo OOS.

String

Não

“”

Parâmetros de saída

Nome do parâmetro

Descrição

Tipo

instanceIdAndInstanceType

List

Política de acesso necessária

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

Detalhes

Detalhes do ACS-ECS-ModifyInstanceSpec

Conteúdo do modelo

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