Tous les produits
Search
Centre de documentation

CloudOps Orchestration Service:ACS-ECS-ModifyInstanceSpec

Dernière mise à jour :Aug 11, 2026

Nom du modèle

ACS-ECS-ModifyInstanceSpec : modifiez le type d'instance d'une instance en mode paiement à l'utilisation.

Exécuter maintenant

Description

Modifiez le type d'instance d'une instance ECS en mode paiement à l'utilisation.

Type de modèle

Automatisation

Propriétaire

Alibaba Cloud

Paramètres d'entrée

Nom du paramètre

Description

Type

Obligatoire

Valeur par défaut

Contrainte

instanceId

ID de l'instance ECS.

String

Oui

modifyInstanceSpecInfo

Mappage des types d'instances pour le passage à une configuration supérieure ou inférieure.

Json

Oui

regionId

ID de la région.

String

Non

{{ ACS::RegionId }}

OOSAssumeRole

Rôle RAM endossé par OOS.

String

Non

“”

Paramètres de sortie

Nom du paramètre

Description

Type

instanceIdAndInstanceType

List

Stratégie d'accès requise

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

Détails

Détails ACS-ECS-ModifyInstanceSpec

Contenu du modèle

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