模板名称
ACS-TAG-UpdateTag 更新标签
模板描述
通过资源管理更新标签
模板类型
自动化
所有者
Alibaba Cloud
输入参数
参数名称 | 描述 | 类型 | 是否必填 | 默认值 | 约束 |
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
resourceType | 资源类型 | String | 否 | "" | |
oldTag | 旧标签 | Json | 否 | {'oosGenerate': 'oosGenerate'} | |
newTag | 新标签 | Json | 否 | {'oosGenerate': 'oosGenerate'} | |
rateControl | 任务执行的并发比率 | Json | 否 | {'Mode': 'Concurrency', 'MaxErrors': '100%', 'Concurrency': 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | "" |
输出参数
参数名称 | 描述 | 类型 |
resourceArns | List | |
untagfailedResource | List | |
tagfailedResource | List |
执行此模板需要的权限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"tag:ListTagResources",
"tag:TagResources",
"tag:UnTagResources"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
详情
模板内容
FormatVersion: OOS-2019-06-01
Description:
en: Update tags through resource management
zh-cn: 通过资源管理更新标签
name-en: ACS-TAG-UpdateTag
name-zh-cn: 更新标签
Parameters:
regionId:
Label:
en: RegionId
zh-cn: 地域ID
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
resourceType:
Label:
en: ResourceType
zh-cn: 资源类型
Type: String
AllowedValues:
- 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
- ''
Default: ''
oldTag:
Label:
en: Old Tag
zh-cn: 旧标签
Description:
en: Only supports one tag
zh-cn: 仅支持一组标签
Type: Json
Default:
oosGenerate: oosGenerate
newTag:
Label:
en: New Tag
zh-cn: 新标签
Description:
en: Only supports one tag
zh-cn: 仅支持一组标签
Type: Json
Default:
oosGenerate: oosGenerate
rateControl:
Label:
en: RateControl
zh-cn: 任务执行的并发比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 100%
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getResourceARN
Action: ACS::ExecuteAPI
Description:
en: Get ResourcesArn with specified tag
zh-cn: 获取带有指定标签的ResourcesArn
Properties:
Service: TAG
API: ListTagResources
Parameters:
RegionId: '{{ regionId }}'
Tags: '{{ oldTag }}'
ResourceARN:
- Fn::If:
- Fn::Equals:
- '{{ resourceType }}'
- ''
- Null
- Fn::Jq:
- First
- .resourceType | ascii_downcase |split("::") | "arn:acs:"+.[1]+":{{ regionId }}:{{ ACS::AccountId }}:"+.[2]+"/*"
- '{"resourceType":"{{resourceType}}"}'
Outputs:
resourceArns:
Type: List
ValueSelector: TagResources[].ResourceARN
- Name: unTagResourcesIfNecessary
Action: ACS::ExecuteAPI
When:
Fn::Not:
Fn::Equals:
- Fn::Jq:
- First
- .[].Key
- Fn::ConvertMapToList:
- '{{ oldTag }}'
- Fn::Jq:
- First
- .[].Key
- Fn::ConvertMapToList:
- '{{ newTag }}'
Description:
en: Delete old tag when the old and new tag key are inconsistent
zh-cn: 当旧标签键与新标签键不一致时删除旧标签
Properties:
Service: TAG
API: UnTagResources
Parameters:
RegionId: '{{ regionId }}'
TagKey:
- Fn::Jq:
- First
- .[].Key
- Fn::ConvertMapToList:
- '{{ oldTag }}'
ResourceARN:
- '{{ACS::TaskLoopItem}}'
Outputs:
failedResource:
Type: List
ValueSelector: FailedResources.FailedResource[]
Loop:
RateControl: '{{rateControl}}'
Items: '{{getResourceARN.resourceArns}}'
Outputs:
untagResult:
AggregateType: Fn::ListJoin
AggregateField: failedResource
- Name: tagResource
Action: ACS::ExecuteApi
Description:
en: Tag resources with new tag through resource management
zh-cn: 通过资源管理给资源打上新的标签
Properties:
Service: TAG
API: TagResources
Parameters:
RegionId: '{{ regionId }}'
ResourceARN:
- '{{ACS::TaskLoopItem}}'
Tags: '{{ newTag }}'
Outputs:
failedResource:
Type: List
ValueSelector: FailedResources.FailedResource[]
Loop:
RateControl: '{{rateControl}}'
Items: '{{getResourceARN.resourceArns}}'
Outputs:
tagResult:
AggregateType: Fn::ListJoin
AggregateField: failedResource
Outputs:
resourceArns:
Type: List
Value: '{{ getResourceARN.resourceArns }}'
untagfailedResource:
Type: List
Value: '{{ unTagResourcesIfNecessary.untagResult }}'
tagfailedResource:
Type: List
Value: '{{ tagResource.tagResult }}'
文档内容是否对您有帮助?