全部产品
Search
文档中心

系统运维管理:ACS-TAG-TagAllResources

更新时间:Nov 22, 2024

模板名称

ACS-TAG-TagAllResources 给所有支持标签的资源打标

立即执行

模板描述

给所有支持标签的资源打标

模板类型

自动化

所有者

Alibaba Cloud

输入参数

参数名称

描述

类型

是否必填

默认值

约束

regionIds

地域ID

List

tags

标签

Json

{'oosGenerate': 'oosGenerate'}

rateControl

任务执行的并发比率

Json

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

OOSAssumeRole

OOS扮演的RAM角色

String

""

输出参数

参数名称

描述

类型

errorMessages

List

errorNumbers

Number

allNumbers

Number

boundResources

List

执行此模板需要的权限策略

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "resourcecenter:SearchResources"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "tag:ListTagResources",
                "tag:TagResources"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

详情

ACS-TAG-TagAllResources详情

模板内容

FormatVersion: OOS-2019-06-01
Description:
  name-en: ACS-TAG-TagAllResources
  name-zh-cn: 给所有支持标签的资源打标
  en: Tag all resources that support tags
  zh-cn: 给所有支持标签的资源打标
Parameters:
  regionIds:
    Type: List
    Label:
      en: RegionId
      zh-cn: 地域ID
    AssociationProperty: RegionId
  tags:
    Label:
      en: Tags
      zh-cn: 标签
    Type: Json
    Default:
      oosGenerate: oosGenerate
  rateControl:
    Label:
      en: RateControl
      zh-cn: 任务执行的并发比率
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: searchResources
    Action: ACS::ExecuteAPI
    Description:
      en: Search resources information
      zh-cn: 查询资源信息
    Properties:
      Service: resourcecenter
      API: SearchResources
      Parameters:
        Filter:
          - Key: RegionId
            Value: '{{ regionIds }}'
            MatchType: equals
          - Key: ResourceType
            Value:
              - ACS::ACK::Cluster
              - ACS::ADB::DBCluster
              - ACS::ADB::DBClusterLakeVersion
              - ACS::AliKafka::ConsumerGroup
              - ACS::AliKafka::Instance
              - ACS::AliKafka::Topic
              - ACS::ALB::Acl
              - ACS::ALB::HealthCheckTemplate
              - ACS::ALB::LoadBalancer
              - ACS::ALB::Listener
              - ACS::ALB::Rule
              - ACS::ALB::SecurityPolicy
              - ACS::ALB::ServerGroup
              - ACS::ApiGateway::Api
              - ACS::ApiGateway::ApiGroup
              - ACS::CBWP::CommonBandwidthPackage
              - ACS::CDN::Domain
              - ACS::CEN::CenInstance
              - ACS::CEN::CenBandwidthPackage
              - ACS::CEN::Flowlog
              - ACS::CEN::TransitRouter
              - ACS::CEN::TransitRouterVbrAttachment
              - ACS::CEN::TransitRouterVpcAttachment
              - ACS::CEN::TransitRouterVpnAttachment
              - ACS::CEN::TransitRouterRouteTable
              - ACS::CEN::TransitRouterPeerAttachment
              - ACS::CEN::TransitRouterMulticastDomain
              - ACS::DCDN::Domain
              - ACS::DdosCoo::Instance
              - ACS::EBS::DedicatedBlockStorageCluster
              - ACS::EBS::DiskReplicaGroup
              - ACS::EBS::DiskReplicaPair
              - ACS::EBS::EnterpriseSnapshotPolicy
              - ACS::ECS::DedicatedHost
              - ACS::ECS::Disk
              - ACS::ECS::Instance
              - ACS::ECS::LaunchTemplate
              - ACS::ECS::NetworkInterface
              - ACS::ECS::SecurityGroup
              - ACS::ECS::Snapshot
              - ACS::ESS::ScalingGroup
              - ACS::ECI::ContainerGroup
              - ACS::ECS::Command
              - ACS::ECS::Image
              - ACS::ECS::KeyPair
              - ACS::ECS::AutoSnapshotPolicy
              - ACS::EIP::EipAddress
              - ACS::ExpressConnect::PhysicalConnection
              - ACS::FC::Service
              - ACS::GPDB::DBInstance
              - ACS::Ga::Accelerator
              - ACS::Ga::Acl
              - ACS::Ga::BandwidthPackage
              - ACS::Ga::BasicAccelerator
              - ACS::Ga::EndpointGroup
              - ACS::HBase::Cluster
              - ACS::MongoDB::DBInstance
              - ACS::NAS::FileSystem
              - ACS::NAT::NatGateway
              - ACS::NLB::Listener
              - ACS::NLB::LoadBalancer
              - ACS::NLB::SecurityPolicy
              - ACS::NLB::ServerGroup
              - ACS::OOS::Application
              - ACS::OOS::Parameter
              - ACS::OOS::SecretParameter
              - ACS::OOS::Template
              - ACS::OSS::Bucket
              - ACS::Ons::Group
              - ACS::Ons::Instance
              - ACS::Ons::Topic
              - ACS::PolarDB::DBCluster
              - ACS::PrivateLink::VpcEndpoint
              - ACS::PrivateLink::VpcEndpointService
              - ACS::RDS::DBInstance
              - ACS::Redis::DBInstance
              - ACS::ResourceManager::Account
              - ACS::ResourceManager::ResourceGroup
              - ACS::SLB::AccessControlList
              - ACS::SLB::CACertificate
              - ACS::SLB::LoadBalancer
              - ACS::SLB::MasterSlaveServerGroup
              - ACS::SLB::ServerCertificate
              - ACS::SLB::VServerGroup
              - ACS::VPC::DhcpOptionsSet
              - ACS::VPC::FlowLog
              - ACS::VPC::GatewayEndpoint
              - ACS::VPC::HaVip
              - ACS::VPC::Ipv4Gateway
              - ACS::VPC::Ipv4Gateway
              - ACS::VPC::Ipv6Gateway
              - ACS::VPC::NetworkAcl
              - ACS::VPC::PrefixList
              - ACS::VPC::PublicIpAddressPool
              - ACS::VPC::RouteTable
              - ACS::VPC::TrafficMirrorFilter
              - ACS::VPC::TrafficMirrorSession
              - ACS::VPC::VPC
              - ACS::VPC::VSwitch
              - ACS::VPN::CustomerGateway
              - ACS::VPN::VpnGateway
              - ALIYUN::ADB::CLUSTER
              - ALIYUN::ALB::ACL
              - ALIYUN::ALB::LOADBALANCER
              - ALIYUN::ALB::SECURITYPOLICY
              - ALIYUN::ALB::SERVERGROUP
              - ALIYUN::ALIDNS::DOMAIN
              - ALIYUN::ALIDNSGTM::GTMINSTANCE
              - ALIYUN::ALIKAFKA::CONSUMERGROUP
              - ALIYUN::ALIKAFKA::INSTANCE
              - ALIYUN::ALIKAFKA::TOPIC
              - ALIYUN::APIGATEWAY::API
              - ALIYUN::APIGATEWAY::APIGROUP
              - ALIYUN::APIGATEWAY::APP
              - ALIYUN::APIGATEWAY::INSTANCE
              - ALIYUN::APIGATEWAY::PLUGIN
              - ALIYUN::ARMS::APPLICATION
              - ALIYUN::ARMS::WEB
              - ALIYUN::AVDS::ASSETS
              - ALIYUN::AVDS::INSTANCE
              - ALIYUN::BAAS::CONSORTIUM
              - ALIYUN::BAAS::ORGANIZATION
              - ALIYUN::BASTIONHOST::INSTANCE
              - ALIYUN::BPSTUDIO::APPLICATION
              - ALIYUN::BPSTUDIO::TEMPLATE
              - ALIYUN::CAS::INSTANCE
              - ALIYUN::CASSANDRA::CLUSTER
              - ALIYUN::CBN::TRANSITROUTERPEERATTACHMENT
              - ALIYUN::CBN::TRANSITROUTERVBRATTACHMENT
              - ALIYUN::CBN::TRANSITROUTERVPCATTACHMENT
              - ALIYUN::CBN::TRANSITROUTERVPNATTACHMENT
              - ALIYUN::CBS::BACKUPPLAN
              - ALIYUN::CDDC::DEDICATEDHOST
              - ALIYUN::CDN::DOMAIN
              - ALIYUN::CDS::CLUSTER
              - ALIYUN::CDT::CDT
              - ALIYUN::CDT::CDTCB
              - ALIYUN::CDT::CDTINTERNET
              - ALIYUN::CEN::BANDWIDTHPACKAGE
              - ALIYUN::CEN::CEN
              - ALIYUN::CLOUDBOX::CLOUDBOX
              - ALIYUN::CLOUDBOX::DEMAND
              - ALIYUN::CLOUDBOX::SITE
              - ALIYUN::CLOUDBOX::SKU
              - ALIYUN::CLOUDPHONE::INSTANCE
              - ALIYUN::CMS::MONITORGROUP
              - ALIYUN::COMPOSER::FLOW
              - ALIYUN::COMPUTENEST::SERVICE
              - ALIYUN::COMPUTENEST::SERVICEINSTANCE
              - ALIYUN::CONFIG::AGGREGATECOMPLIANCEPACK
              - ALIYUN::CONFIG::AGGREGATECONFIGRULE
              - ALIYUN::CONFIG::AGGREGATOR
              - ALIYUN::CONFIG::COMPLIANCEPACK
              - ALIYUN::CONFIG::RULE
              - ALIYUN::CR::CHARTNAMESPACE
              - ALIYUN::CR::CHARTREPOSITORY
              - ALIYUN::CR::INSTANCE
              - ALIYUN::CR::NAMESPACE
              - ALIYUN::CR::REPOSITORY
              - ALIYUN::CS::CLUSTER
              - ALIYUN::DATAHUB::PROJECT
              - ALIYUN::DATAHUB::TOPIC
              - ALIYUN::DATAV::SCREEN
              - ALIYUN::DBAUDIT::INSTANCE
              - ALIYUN::DCDN::DOMAIN
              - ALIYUN::DCDNIPA::DOMAIN
              - ALIYUN::DDOSBGP::INSTANCE
              - ALIYUN::DDOSCOO::INSTANCE
              - ALIYUN::DDS::INSTANCE
              - ALIYUN::DDS::SHARDINGINSTANCE
              - ALIYUN::DIDE::PROJECT
              - ALIYUN::DOMAIN::DOMAIN
              - ALIYUN::DRDS::INSTANCE
              - ALIYUN::DTS::CONSUMERCHANNEL
              - ALIYUN::DTS::INSTANCE
              - ALIYUN::DTS::JOBMONITORRULE
              - ALIYUN::DTS::MIGRATIONJOB
              - ALIYUN::DTS::SUBSCRIPTIONJOB
              - ALIYUN::DTS::SYNCHRONIZATIONJOB
              - ALIYUN::DYSMS::TEMPLATE
              - ALIYUN::EBS::DBSC
              - ALIYUN::EBS::DEDICATEDBLOCKSTORAGECLUSTER
              - ALIYUN::EBS::DISKREPLICAGROUP
              - ALIYUN::EBS::DISKREPLICAPAIR
              - ALIYUN::EBS::GROUP
              - ALIYUN::EBS::PAIR
              - ALIYUN::ECI::CONTAINERGROUP
              - ALIYUN::ECI::IMAGECACHE
              - ALIYUN::ECI::LAUNCHTEMPLATE
              - ALIYUN::ECI::VIRTUALNODE
              - ALIYUN::ECS::CAPACITYRESERVATION
              - ALIYUN::ECS::COMMAND
              - ALIYUN::ECS::DDH
              - ALIYUN::ECS::DDHCLUSTER
              - ALIYUN::ECS::DISK
              - ALIYUN::ECS::ELASTICITYASSURANCE
              - ALIYUN::ECS::ENI
              - ALIYUN::ECS::IMAGE
              - ALIYUN::ECS::IMAGECOMPONENT
              - ALIYUN::ECS::IMAGEPIPELINE
              - ALIYUN::ECS::INSTANCE
              - ALIYUN::ECS::INVOCATION
              - ALIYUN::ECS::KEYPAIR
              - ALIYUN::ECS::LAUNCHTEMPLATE
              - ALIYUN::ECS::RESERVEDINSTANCE
              - ALIYUN::ECS::SCU
              - ALIYUN::ECS::SECURITYGROUP
              - ALIYUN::ECS::SNAPSHOT
              - ALIYUN::ECS::SNAPSHOTGROUP
              - ALIYUN::ECS::SNAPSHOTPOLICY
              - ALIYUN::ECS::VOLUME
              - ALIYUN::EDAS::APPLICATION
              - ALIYUN::EDAS::CLUSTER
              - ALIYUN::EDAS::NAMESPACE
              - ALIYUN::EHPC::CLUSTER
              - ALIYUN::ELASTICSEARCH::APM
              - ALIYUN::ELASTICSEARCH::INSTANCE
              - ALIYUN::ELASTICSEARCH::LOGSTASH
              - ALIYUN::EMR::CLUSTER
              - ALIYUN::EMR::FLOWPROJECT
              - ALIYUN::EMR::INSTANCE
              - ALIYUN::ESS::SCALINGGROUP
              - ALIYUN::EXPRESSCONNECT::PHYSICALCONNECTION
              - ALIYUN::FC::SERVICE
              - ALIYUN::FLINKASI::VVPINSTANCE
              - ALIYUN::FLINKASI::VVPNAMESPACE
              - ALIYUN::GA::ACL
              - ALIYUN::GDS::INSTANCE
              - ALIYUN::GPDB::INSTANCE
              - ALIYUN::GWS::INSTANCE
              - ALIYUN::GWS::USER
              - ALIYUN::HBR::CLIENT
              - ALIYUN::HBR::HANAINSTANCE
              - ALIYUN::HBR::VAULT
              - ALIYUN::HCS_SGW::GATEWAY
              - ALIYUN::HITSDB::INSTANCE
              - ALIYUN::HOLOGRAM::INSTANCE
              - ALIYUN::HOLOGRES::INSTANCE
              - ALIYUN::HSM::INSTANCE
              - ALIYUN::IACSERVICE::AUTHORIZATION
              - ALIYUN::IACSERVICE::JOB
              - ALIYUN::IACSERVICE::MODULE
              - ALIYUN::IACSERVICE::MODULEMARKET
              - ALIYUN::IACSERVICE::MODULEVERSION
              - ALIYUN::IACSERVICE::TASK
              - ALIYUN::IMAGESEARCH::INSTANCE
              - ALIYUN::IOT::PRODUCT
              - ALIYUN::IOT::RULE
              - ALIYUN::KMS::KEY
              - ALIYUN::KMS::SECRET
              - ALIYUN::KVSTORE::AUDITLOGCONFIG
              - ALIYUN::KVSTORE::INSTANCE
              - ALIYUN::LICENSEMANAGER::GRANT
              - ALIYUN::LICENSEMANAGER::LICENSE
              - ALIYUN::LIVE::DOMAIN
              - ALIYUN::LOG::LOGSTORE
              - ALIYUN::LOG::PROJECT
              - ALIYUN::MQ::GROUP
              - ALIYUN::MQ::INSTANCE
              - ALIYUN::MQ::TOPIC
              - ALIYUN::MSE::CLUSTER
              - ALIYUN::MSE::GATEWAY
              - ALIYUN::MTS::MEDIAINFO
              - ALIYUN::MTS::SNAPSHOT
              - ALIYUN::MTS::TRANSCODE
              - ALIYUN::MULTIMOD::CLUSTER
              - ALIYUN::NAS::FILESYSTEM
              - ALIYUN::NLB::LOADBALANCER
              - ALIYUN::NLB::SECURITYPOLICY
              - ALIYUN::NLB::SERVERGROUP
              - ALIYUN::NLP::ENTITY
              - ALIYUN::NLP::IE
              - ALIYUN::NLP::KWE
              - ALIYUN::NLP::REVIEWANALYSIS
              - ALIYUN::NLP::SENTIMENT
              - ALIYUN::NLP::TEXTSTRUCTURE
              - ALIYUN::NLP::WORDPOS
              - ALIYUN::OCEANBASE::INSTANCE
              - ALIYUN::OCEANBASE::TENANT
              - ALIYUN::OOS::APPLICATION
              - ALIYUN::OOS::EXECUTION
              - ALIYUN::OOS::OPSITEM
              - ALIYUN::OOS::OPSITEMCONFIGURATION
              - ALIYUN::OOS::PARAMETER
              - ALIYUN::OOS::SECRETPARAMETER
              - ALIYUN::OOS::STATECONFIGURATION
              - ALIYUN::OOS::TEMPLATE
              - ALIYUN::OPENANALYTICS::INSTANCE
              - ALIYUN::OPENSEARCH::APPGROUP
              - ALIYUN::OPENSEARCH::INSTANCE
              - ALIYUN::OSS::BUCKET
              - ALIYUN::OTS::INSTANCE
              - ALIYUN::OUTBOUNDBOT::INSTANCE
              - ALIYUN::PETADATA::INSTANCE
              - ALIYUN::POLARDB::CLUSTER
              - ALIYUN::POLARDBX::POLARDBXINSTANCE
              - ALIYUN::PRIVATELINK::VPCENDPOINT
              - ALIYUN::PRIVATELINK::VPCENDPOINTSERVICE
              - ALIYUN::PVTZ::ZONE
              - ALIYUN::RAM::USER
              - ALIYUN::RDS::ACCOUNT
              - ALIYUN::RDS::ACTIONEVENTPOLICY
              - ALIYUN::RDS::BACKUP
              - ALIYUN::RDS::BACKUPFILE
              - ALIYUN::RDS::BACKUPPOLICY
              - ALIYUN::RDS::DATABASE
              - ALIYUN::RDS::DBPROXY
              - ALIYUN::RDS::DEDICATEDHOST
              - ALIYUN::RDS::DOWNLOADLINKDETAIL
              - ALIYUN::RDS::GADINSTANCE
              - ALIYUN::RDS::INSTANCE
              - ALIYUN::RDS::PARAMETERGROUP
              - ALIYUN::RM::ACCOUNT
              - ALIYUN::RM::INSTANCE
              - ALIYUN::RM::RESOURCEGROUP
              - ALIYUN::RM::RESOURCESHARE
              - ALIYUN::RM::SHAREDRESOURCE
              - ALIYUN::RM::SHAREDTARGET
              - ALIYUN::RM::TOPIC
              - ALIYUN::ROCKETMQ::CONSUMERGROUP
              - ALIYUN::ROCKETMQ::INSTANCE
              - ALIYUN::ROCKETMQ::TOPIC
              - ALIYUN::ROS::CHANGESET
              - ALIYUN::ROS::STACK
              - ALIYUN::ROS::STACKGROUP
              - ALIYUN::ROS::TEMPLATE
              - ALIYUN::SAE::APPLICATION
              - ALIYUN::SAG::CCN
              - ALIYUN::SAVINGPLAN::INSTANCE
              - ALIYUN::SCBLINKONECS::CLUSTER
              - ALIYUN::SCDN::DOMAIN
              - ALIYUN::SEARCHENGINE::INSTANCE
              - ALIYUN::SLB::ACL
              - ALIYUN::SLB::CERTIFICATE
              - ALIYUN::SLB::INSTANCE
              - ALIYUN::SMARTAG::ABWP
              - ALIYUN::SMARTAG::ACL
              - ALIYUN::SMARTAG::CCN
              - ALIYUN::SMARTAG::FLOWLOG
              - ALIYUN::SMARTAG::QOS
              - ALIYUN::SMARTAG::SMARTAG
              - ALIYUN::SMARTAG::SMARTAG_B
              - ALIYUN::SMARTAG::SMARTAG_D
              - ALIYUN::SMARTAG::SMARTAG_S
              - ALIYUN::SMARTHOSTING::HBM
              - ALIYUN::SMARTHOSTING::MANAGEDHOST
              - ALIYUN::SMARTHOSTING::MPS
              - ALIYUN::SMC::REPLICATIONJOB
              - ALIYUN::SMC::SOURCESERVER
              - ALIYUN::SPARK::CLUSTER
              - ALIYUN::TESTAMP::INSTANCE
              - ALIYUN::TESTPRODUCT::TEST2
              - ALIYUN::TESTPRODUCT::TESTTYPE
              - ALIYUN::TESTPRODUCT::XXX
              - ALIYUN::TESTPRODUCT::XXXX
              - ALIYUN::VOD::APPINFO
              - ALIYUN::VOD::DOMAIN
              - ALIYUN::VPC::COMMONBANDWIDTHPACKAGE
              - ALIYUN::VPC::CUSTOMERGATEWAY
              - ALIYUN::VPC::EIP
              - ALIYUN::VPC::FLOWLOG
              - ALIYUN::VPC::HAVIP
              - ALIYUN::VPC::IPSECSERVER
              - ALIYUN::VPC::IPV4GATEWAY
              - ALIYUN::VPC::IPV6BANDWIDTH
              - ALIYUN::VPC::IPV6GATEWAY
              - ALIYUN::VPC::IPV6INSTANCE
              - ALIYUN::VPC::NATGATEWAY
              - ALIYUN::VPC::PHYSICALCONNECTION
              - ALIYUN::VPC::PREFIXLIST
              - ALIYUN::VPC::PUBLICIPADDRESSPOOL
              - ALIYUN::VPC::ROUTETABLE
              - ALIYUN::VPC::SSLVPNCLIENTCERT
              - ALIYUN::VPC::SSLVPNSERVER
              - ALIYUN::VPC::TRAFFICMIRRORFILTER
              - ALIYUN::VPC::TRAFFICMIRRORSESSION
              - ALIYUN::VPC::VPC
              - ALIYUN::VPC::VPNATTACHMENT
              - ALIYUN::VPC::VPNCONNECTION
              - ALIYUN::VPC::VPNGATEWAY
              - ALIYUN::VPC::VSWITCH
              - ALIYUN::WAF::DOMAIN
            MatchType: equals
    Outputs:
      resources:
        Type: List
        ValueSelector: .Resources | group_by(.RegionId) | .[]
  - Name: tagResources
    Action: ACS::TAG::TagResources
    Description:
      en: Tag resources for resources
      zh-cn: 给指定的资源集打上指定标签
    Properties:
      resources: '{{ ACS::TaskLoopItem }}'
      tags: '{{ tags }}'
    Outputs:
      errorMessage:
        Type: List
        ValueSelector: .errorMessage
      errorNumber:
        Type: Number
        ValueSelector: .errorNumber
      allNumber:
        Type: Number
        ValueSelector: .allNumber
    Loop:
      Items: '{{ searchResources.resources }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        errorMessages:
          AggregateType: Fn::ListJoin
          AggregateField: errorMessage
        errorNumbers:
          AggregateType: Fn::Sum
          AggregateField: errorNumber
        allNumbers:
          AggregateType: Fn::Sum
          AggregateField: allNumber
  - Name: listTagResources
    Action: ACS::ExecuteAPI
    Description:
      en: Query resources bound to specified tags through resource management
      zh-cn: 通过资源管理查询绑定指定标签的资源
    Properties:
      Service: TAG
      API: ListTagResources
      Parameters:
        RegionId: '{{ ACS::TaskLoopItem }}'
        Tags: '{{ tags }}'
    Outputs:
      boundResources:
        Type: List
        ValueSelector: .TagResources[] | .ResourceARN
    Loop:
      Items: '{{ regionIds }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        boundResources:
          AggregateType: Fn::ListJoin
          AggregateField: boundResources
Outputs:
  errorMessages:
    Type: List
    Value: '{{ tagResources.errorMessages }}'
  errorNumbers:
    Type: Number
    Value: '{{ tagResources.errorNumbers }}'
  allNumbers:
    Type: Number
    Value: '{{ tagResources.allNumbers }}'
  boundResources:
    Type: List
    Value: '{{ listTagResources.boundResources }}'