模板名稱
ACS-TAG-TagResources 通過資源管理給資源打標籤
模板描述
通過資源管理給其管理的資源打標籤
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 預設值 | 約束 |
resourceIds | 資源ID | List | 是 | ||
resourceType | 資源類型 | String | 是 | ||
regionId | 地區ID | String | 否 | {{ ACS::RegionId }} | |
tags | 標籤 | Json | 否 | {'oosGenerate': 'oosGenerate'} | |
rateControl | 任務執行的並發比率 | Json | 否 | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | "" |
輸出參數
參數名稱 | 描述 | 類型 |
resourceIdsAndTag | List |
執行此模板需要的權限原則
{
"Version": "1",
"Statement": [
{
"Action": [
"tag:ListTagResources",
"tag:TagResources"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
模板內容
FormatVersion: OOS-2019-06-01
Description:
en: Tag the resources it manages through resource management
zh-cn: 通過資源管理給其管理的資源打標籤
name-en: ACS-TAG-TagResources
name-zh-cn: 通過資源管理給資源打標籤
categories:
- security
Parameters:
regionId:
Label:
en: RegionId
zh-cn: 地區ID
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
resourceIds:
Label:
en: ResourceIds
zh-cn: 資源ID
Type: List
resourceType:
Label:
en: ResourceType
zh-cn: 資源類型
Type: String
AllowedValues:
- ACS::ACK::Cluster
- ACS::ADB::DBCluster
- ACS::ADB::DBClusterLakeVersion
- ACS::ALB::Acl
- ACS::ALB::HealthCheckTemplate
- ACS::ALB::Listener
- ACS::ALB::LoadBalancer
- ACS::ALB::Rule
- ACS::ALB::SecurityPolicy
- ACS::ALB::ServerGroup
- ACS::AliKafka::ConsumerGroup
- ACS::AliKafka::Instance
- ACS::AliKafka::Topic
- ACS::ApiGateway::Api
- ACS::ApiGateway::ApiGroup
- ACS::CBWP::CommonBandwidthPackage
- ACS::CDN::Domain
- ACS::CEN::CenBandwidthPackage
- ACS::CEN::CenInstance
- ACS::CEN::Flowlog
- ACS::CEN::TransitRouter
- ACS::CEN::TransitRouterMulticastDomain
- ACS::CEN::TransitRouterPeerAttachment
- ACS::CEN::TransitRouterRouteTable
- ACS::CEN::TransitRouterVbrAttachment
- ACS::CEN::TransitRouterVpcAttachment
- ACS::CEN::TransitRouterVpnAttachment
- ACS::DCDN::Domain
- ACS::DdosCoo::Instance
- ACS::EBS::DedicatedBlockStorageCluster
- ACS::EBS::DiskReplicaGroup
- ACS::EBS::DiskReplicaPair
- ACS::EBS::EnterpriseSnapshotPolicy
- ACS::ECI::ContainerGroup
- ACS::ECS::AutoSnapshotPolicy
- ACS::ECS::Command
- ACS::ECS::DedicatedHost
- ACS::ECS::Disk
- ACS::ECS::Image
- ACS::ECS::Instance
- ACS::ECS::KeyPair
- ACS::ECS::LaunchTemplate
- ACS::ECS::NetworkInterface
- ACS::ECS::SecurityGroup
- ACS::ECS::Snapshot
- ACS::EIP::EipAddress
- ACS::ESS::ScalingGroup
- 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::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::SLS::Project
- 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
tags:
Label:
en: Tags
zh-cn: 標籤
Description:
en: The resource tag(example:{"k1":"v1","k2":"v2"})
zh-cn: 資源標籤(例:{"k1":"v1","k2":"v2"})
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: tagResource
Action: ACS::CheckFor
Description:
en: Tag the resources it manages through resource management
zh-cn: 通過資源管理給其管理的資源打標籤
Properties:
Service: TAG
API: TagResources
Parameters:
RegionId: '{{ regionId }}'
ResourceARN:
- 'Fn::Jq':
- First
- '.resourceType | ascii_downcase |split("::") | "arn:acs:"+.[1]+":{{ regionId }}:{{ ACS::AccountId }}:"+.[2]+"/{{ ACS::TaskLoopItem }}"'
- '{"resourceType":"{{resourceType}}"}'
Tags: "{{ tags }}"
DesiredValues:
- null
PropertySelector: .FailedResources.FailedResource[]
Loop:
Items: '{{ resourceIds }}'
RateControl: '{{ rateControl }}'
Outputs:
errorMessages:
AggregateType: 'Fn::ListJoin'
AggregateField: errorMessage
Outputs:
errorMessage:
Type: String
ValueSelector: .FailedResources.FailedResource[]
- Name: listTagResources
Action: ACS::ExecuteAPI
Description:
en: Query the resource tags
zh-cn: 查詢資源標籤資訊
Properties:
Service: TAG
API: ListTagResources
Parameters:
RegionId: '{{ regionId }}'
ResourceARN:
- 'Fn::Jq':
- First
- '.resourceType | ascii_downcase |split("::") | "arn:acs:"+.[1]+":{{ regionId }}:{{ ACS::AccountId }}:"+.[2]+"/{{ ACS::TaskLoopItem }}"'
- '{"resourceType":"{{resourceType}}"}'
Outputs:
tagAndResourceId:
Type: Json
ValueSelector: .TagResources
Loop:
Items: '{{ resourceIds }}'
RateControl: '{{ rateControl }}'
Outputs:
tagAndResourceIds:
AggregateType: Fn::ListJoin
AggregateField: tagAndResourceId
Outputs:
resourceIdsAndTag:
Type: List
Value:
'Fn::If':
- 'Fn::Equals':
- []
- 'Fn::MergeList': '{{ tagResource.errorMessages }}'
- '{{ listTagResources.tagAndResourceIds }}'
- errcode: '{{ tagResource.errorMessages }}'
results: '{{ listTagResources.tagAndResourceIds }}'