All Products
Search
Document Center

Resource Management:Enable automatic tag inheritance from a resource group

Last Updated:Oct 20, 2023

Resource Management provides the automatic tag inheritance feature. This feature allows resources that are added to or created in a resource group to automatically inherit the tags that are added to the resource group.

Background information

For information about Alibaba Cloud services that support the automatic tag inheritance feature, see the Support for automatic tag inheritance from a resource group column in Services that support tag policies.

Procedure

This example shows how to enable Elastic Compute Service (ECS) instances in a resource group to automatically inherit the tag env:test that is added to the resource group.

  1. Add a tag to a resource group.

    In this example, the tag env:test is used. For more information, see Add a tag to a resource group.

  2. Enable the Tag Policy feature.

    For more information, see Enable the Tag Policy feature.

  3. Create a tag policy.

    1. Go to the Current Account tab of the Policy Library page in the Resource Management console and click Create Tag Policy.

    2. On the Create Tag Policy page, enter a policy name in the Policy Name field.

    3. Enter a description for the tag policy in the Policy Description field.

    4. Configure the tag policy on the Quick Mode tab.

      1. Enter env in the Tag Key field.

      2. Select Automatically Inherit Tags for Resources from Resource Groups for Select Policy Scenario.

      3. Select Specify the detected resource type for this tag key and click Specify Resource Types. In the dialog box that appears, select all resource types of ECS.

        By default, the tag policy detects resources of all resource types that are supported. If you select a specific resource type, the tag policy detects only the resources of the selected resource type.

      4. Select Specify Resource Groups and click Select Resource Groups. In the Specify Resource Groups dialog box, select the resource group that is used in Step 1 and click OK.

        Note
        • By default, a tag policy in single-account mode takes effect for all resource groups. However, you can specify the resource groups for which you want the tag policy to take effect. You can specify a maximum of 20 resource groups.

        • By default, a tag policy in resource directory mode takes effect for all resource groups. You cannot specify the resource groups for which you want the tag policy to take effect.

      5. If you do not want some resources in the resource group to inherit the tag, select Specify IDs of Resources to Be Excluded and click Specify Resource IDs. In the Specify IDs of Resources to Be Excluded dialog box, enter the resource IDs that you want to exclude. Then, click OK.

        Note

        You can specify a maximum of 20 resource IDs that you want to exclude.

    5. Click Create.

  4. Attach the tag policy.

    1. Go to the Current Account tab of the Policy Library page, find the tag policy created in Step 3 and click Attach in the Actions column.

    2. In the Attach message, click OK.

      The tag policy takes effect for the current Alibaba Cloud account and RAM users within the account.

  5. Check whether the tag policy is in effect.

    If the tag env:test is automatically added to the ECS instances in the resource group, the tag policy is in effect. If other tags are added to the resource group but the tags are not defined in the tag policy, the ECS instances in the resource group do not automatically inherit the tags.

    Note

    You must wait a period of time before a tag policy that is attached to an object takes effect. For information about the time that is required, see Limits in Overview.