Tous les produits
Search
Centre de documentation

CloudOps Orchestration Service:ACS-ECS-BulkyTagInstances

Dernière mise à jour :Aug 11, 2026

Nom du modèle

ACS-ECS-BulkyTagInstances : ajoute des tags à des instances ECS par lot

Exécuter maintenant

Description du modèle

Ajoute des tags à plusieurs instances ECS simultanément.

Type de modèle

Automatisé

Propriétaire

Alibaba Cloud

Paramètres d'entrée

Paramètre

Description

Type

Obligatoire

Valeur par défaut

Limite

targets

Instances ECS cibles.

Json

Oui

tags

Tags à ajouter aux instances ECS.

Json

Oui

regionId

ID de la région.

String

Non

{{ ACS::RegionId }}

rateControl

Contrôle de la concurrence lors de l'exécution des tâches.

Json

Non

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

OOSAssumeRole

Rôle RAM utilisé par OOS.

String

Non

""

Paramètres de sortie

Aucun

Politique d'autorisation requise

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:TagResources"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Détails

Le code source du modèle est disponible dans le fichier ACS-ECS-BulkyTagInstances.yml sur GitHub.

Contenu du modèle

FormatVersion: OOS-2019-06-01
Description:
  name-en: ACS-ECS-BulkyTagInstances
  name-zh-cn: Batch attach tags to ECS instances
  en: Bulky tag ECS instances
  zh-cn: Batch attach tags to ECS instances
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: Region ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: Target Instance
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  tags:
    Label:
      en: Tags
      zh-cn: Tags to attach to the ECS instances
    Type: Json
    AssociationProperty: Tags
  rateControl:
    Label:
      en: RateControl
      zh-cn: Concurrency rate for task execution
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role assumed by OOS
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: Views the ECS instances
      zh-cn: Views the ECS instances
    Action: 'ACS::SelectTargets'
    Properties:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'
  - Name: tagResources
    Action: 'ACS::ExecuteApi'
    Description:
      en: Creates and attaches tag to ECS instance
      zh-cn: Creates and attaches tag to ECS instance
    Properties:
      Service: ECS
      API: TagResources
      Parameters:
        RegionId: '{{ regionId }}'
        ResourceIds:
          - '{{ ACS::TaskLoopItem }}'
        ResourceType: Instance
        Tags: '{{ tags }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ getInstance.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - tags
        Label:
          default:
            zh-cn: Configure Parameters
            en: Configure Parameters
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: Select Ecs Instances
            en: Select Ecs Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Control Options
            en: Control Options