You can use the tag inheritance feature to automatically propagate tags from a primary resource to its associated resources. This process occurs when you modify the tags of the primary resource or create an association, improving O&M efficiency. For example, when you add a tag to an ECS instance, its associated resources, such as disks, elastic network interfaces, and elastic IP addresses, automatically inherit the tag. Newly associated resources also inherit the tag.
Background information
You can manage tag inheritance by using your Alibaba Cloud account or a RAM user that has the AliyunTagAdministratorAccess permissions. For more information, see Create a RAM user and Manage RAM user permissions.
Limits
-
For a list of resource types that support this feature, see Resources that support tag inheritance.
-
When configuring a rule to inherit only specific tags, you can specify up to 50 tag keys.
-
After you enable and configure a tag inheritance rule, if an inherited tag has the same key as an existing tag on an associated resource, the system overwrites the existing tag. For example, an associated resource has the tag
cost:hangzhouand the primary resource has the tagcost:shanghai. If you configure a rule that allows the associated resource to inherit the tag with thecostkey, the tagcost:hangzhouon the associated resource is overwritten withcost:shanghai. -
For some resource types, you can apply tag inheritance to existing associated resources by turning on the Apply to Existing Resources switch. For information about the supported resource types, see the Supports applying to existing resources column in Resources that support tag inheritance.
Operations
Enable tag inheritance
-
Go to the Tag inheritance page.
-
Read the instructions, select the checkbox to create a service-linked role, and then click Enable and Configure Rules.
After you enable this feature, a service-linked role named AliyunServiceRoleForTag is created. This role is used to manage tags on associated resources. For more information, see Service-linked role for Tag.
Enable a rule
-
On the Tag inheritance page, find the target resource type and click Enable Rule in the Actions column.
-
In the Enable Rule dialog box, configure the rule and click Enable.
Example: After you enable the rule, an elastic network interface automatically inherits the tags of an ECS instance when it is attached to the ECS instance. The tags of the elastic network interface stay in sync with the tags of the ECS instance. When the elastic network interface is detached, the system automatically removes the inherited tags from it.
-
Applicable Scope: Specify the tag keys of the tags that you want to inherit. You can inherit all tag keys or only some tag keys.
-
Apply to Existing Resources: If you turn on this switch, the rule also applies to existing resources.
-
Modify a rule
-
On the Tag inheritance page, find the target resource type and click Modify Rule in the Actions column.
-
In the Modify Rule dialog box, modify the rule and click Modify.
You can modify the Applicable Scope and enable or disable the Apply to Existing Resources switch.
Disable a rule
After you disable a tag inheritance rule, associated resources no longer automatically inherit tags from their primary resources. This may affect tag-based operations, such as resource management and cost allocation.
-
On the Tag inheritance page, find the target resource type and click Disable Rule in the Actions column.
-
In the Disable Rule dialog box, click Disable.
Manage rules in bulk
On the Tag inheritance page, you can select multiple resource types and manage their rules in bulk.
-
In the lower-left corner of the list, click Enable Rule to enable multiple rules at a time.
-
In the lower-left corner of the list, click Disable Rule to disable multiple rules at a time.
-
In the lower-left corner of the list, click Apply to Existing Resources to apply tag inheritance to existing associated resources in bulk.
Disable tag inheritance
After you disable the tag inheritance feature, the system no longer performs tag operations on associated resources. Existing tags on resources are not affected.
-
In the upper-right corner of the Tag inheritance page, click Disable.
-
In the confirmation dialog box, click Close.
Resources that support tag inheritance
|
Primary resource |
Associated resource |
Triggering condition |
Supports existing resources |
Rule name (SettingName) |
|
ECS instance |
disk (including data disk and system disk) |
|
Yes |
|
|
elastic network interface (including primary and secondary ENIs) |
|
Yes |
|
|
|
elastic IP address |
|
Yes |
rule:AssociateEip-UnassociateEip-TagInstance:Ecs-Instance:Vpc-Eip |
|
|
disk |
snapshot |
|
Yes |
|
|
ApsaraMQ for Kafka instance |
topic |
|
Yes |
|
|
consumer group |
|
Yes |
|
|
|
Container Service for Kubernetes (ACK) cluster |
security group |
The security group's tags stay in sync with the cluster's tags. |
No |
|
|
ECS instance |
|
No |
|
|
|
Classic Load Balancer (CLB) instance |
The CLB instance's tags stay in sync with the cluster's tags. |
No |
|
|
|
elastic IP address |
The elastic IP address's tags stay in sync with the cluster's tags. |
No |
|
|
|
NAT gateway |
The NAT gateway's tags stay in sync with the cluster's tags. |
No |
|
|
|
scaling group |
The scaling group's tags stay in sync with the cluster's tags. |
No |
|
|
|
Classic Load Balancer (CLB) instance |
elastic IP address |
|
Yes |
|
|
Network Load Balancer (NLB) instance |
elastic IP address |
|
No |
|
|
Application Load Balancer (ALB) instance |
elastic IP address |
|
No |
|
|
Virtual Private Cloud (VPC) NAT gateway |
elastic IP address |
|
Yes |
|
|
Elastic Container Instance (ECI) container group |
elastic IP address |
|
No |
|
Supported regions
China (Beijing), China (Chengdu), China (Fuzhou - Local Region) (Discontinued), China (Guangzhou), China (Hangzhou), China (Heyuan), China (Hohhot), China (Hong Kong), China (Nanjing - Local Region) (Discontinued), China (Qingdao), China (Shanghai), China (Shenzhen), China (Ulanqab), China (Zhangjiakou), Germany (Frankfurt), Indonesia (Jakarta), Japan (Tokyo), Malaysia (Kuala Lumpur), Philippines (Manila), Singapore, Thailand (Bangkok), UK (London), US (Silicon Valley), and US (Virginia).