All Products
Search
Document Center

Elastic Compute Service:use tags to automatically assign ECS instances to CloudMonitor application groups

Last Updated:Mar 27, 2024

You can add the same tag to Elastic Compute Service (ECS) instances that serve the same business requirements. Then, use the smart tag synchronization feature of CloudMonitor to allow CloudMonitor to automatically assign ECS instances to the same CloudMonitor application group. This way, ECS instances can be automatically monitored by group based on tags. This facilitates centralized O&M and management of ECS instances that have the same tag added.

Considerations

In ECS, only ECS instances support automatic resource monitoring by group based on tags. Other ECS resources, such as elastic network interfaces (ENIs), disks, and snapshots, do not support automatic resource monitoring by group based on tags. For information about the ECS resources to which you can add tags, see Overview.

Background information

The application group feature of CloudMonitor allows you to manage alert rules and view monitoring data by group. This reduces management complexity. For more information, see Application groups. ECS instances that have a specific tag added are automatically identified and assigned to a CloudMonitor application group based on the matching rule of the group. In this topic, ECS instances that are automatically created in a scaling group and have the testKey:testValue tag added are used. The ECS instances are identified and assigned to a CloudMonitor application group that has the testKey:testValue tag added.

To implement automatic resource monitoring by group based on tags, you can use one of the following methods:

  • Create ECS resources that have tags added or add tags to existing ECS resources. Then, create a CloudMonitor application group that supports smart tag synchronization. Make sure that the tags of the CloudMonitor application group are the same as the tags of the ECS resources.

  • Create a CloudMonitor application group that supports smart tag synchronization, and add a custom tag to the matching rule of the CloudMonitor application group. Then, create ECS resources that have the tag added or add the tag to existing ECS resources. The ECS resources are automatically assigned to the CloudMonitor application group.

Step 1: Create ECS instances that have a specific tag added

You can create ECS instances that have a specific tag added or add the tag to existing ECS instances. For more information, see Create or add a tag. You can also perform the following operations to use Auto Scaling to add a specific tag to the ECS instances in a scaling group:

  1. Log on to the Auto Scaling console.

  2. Create a scaling group.

    For more information, see Manage scaling groups. In this example, the following operations are performed:

    • Set the Minimum Number of Instances parameter to 4.

    • Configure the Scaling Policy parameter based on your business requirements to implement high-availability auto scaling.

    1

  3. Create a scaling configuration.

    For more information, see Create a scaling configuration of the ECS type. You must add the testKey:testValue tag in the Management Settings section.标签en.png

  4. Go to the scaling group details page, click the Instances tab, and then view the ECS instances that are automatically created in the scaling group.

    1

Step 2: Create a CloudMonitor application group

  1. Log on to the CloudMonitor console.

  2. Create a CloudMonitor application group.

    For more information, see Create an application group.

    In this example, the Creation Method parameter is set to Create Based on Tags and the testKey:testValue tag is added to the matching rule to create a CloudMonitor application group. Then, the ECS instances that have the tag added are assigned to the CloudMonitor application group.

    1. Set the Creation Method parameter to Create Based on Tags.

      1

    2. Set the Resource Tag Key parameter to testKey and configure the Tag Value parameter based on your requirements. In this example, Contain is selected from the Tag Value drop-down list and testValue is entered in the Tag Value field.

      1

Step 3: View the monitoring information of the ECS instances

In the CloudMonitor console, you can check whether the ECS instances that are automatically created in the scaling group are automatically added to the CloudMonitor application group.

Note

On the Tags page in the ECS console, you can view the CPU utilization, memory usage, and system load of the ECS instances that have the tag added. For more information, see Search for resources by tag.

  1. Log on to the CloudMonitor console.

  2. In the left-side navigation pane, click Application Groups.

  3. On the Application Groups tab, select Resource Tag from the drop-down list, enter testKey in the search box, and then click Search.

    1

  4. Click testKey-testValue-53** / 22****** in the Group Name / Group ID column to view the resources in the group.

    The following figure shows that the ECS instances that are automatically created in the scaling group are automatically added to the CloudMonitor application group. You can also view the monitoring data of the ECS instances. For more information, see Cloud service monitoring.1

References

  • Auto Scaling is an Alibaba Cloud service that automatically adds or removes instances based on workload changes and scaling policies. You can use Auto Scaling to ensure sufficient computing resources, prevent idle resources, and reduce costs. For more information, see What is Auto Scaling?

  • You can also monitor the information of an ECS instance in the ECS console and CloudMonitor console to ensure that the ECS instance always runs as expected. For more information, see View the monitoring information of an ECS instance.