Tag-based automatic resource association and backup
To make it easier to associate a backup policy with multiple resources at scale, Cloud Backup provides the Associate Resource Tag feature. A backup policy can associate resources in bulk based on tags, and dynamically associate or disassociate resources as tags change. This topic introduces the feature, its supported scope and limits, notes, how it works, and where to get started.
Features
-
The resource tags of a backup policy support two types: all resources and specified tags.
All resources: the backup policy automatically backs up all your resources of the resource type that you specify.
Specified tags: the backup policy automatically backs up resources of the resource type that you specify and that match the tags.
-
When you create or edit a backup policy, you can select the account scope of the resources in the Specified Account area: the current account, one or more accounts to back up, or All Accounts. By default, the current account is selected. If you select All Accounts, the option covers all accounts managed in cross-account backup management, including accounts that will be added in the future.
A backup policy can contain multiple resource cards. Each card independently specifies the resource type, account scope, and tag rules, and the cards do not affect each other.
-
Specified tags support multiple tag rules, and a backup policy automatically backs up only resources that match all tag rules at the same time. For example, if you add two tag rules — one with tag key env, match condition equals, and tag value prod, and one with tag key team, match condition equals, and tag value backup — only resources tagged with both env=prod and team=backup are automatically backed up.
Each tag rule specifies a tag key and a tag value and defines the match condition for the tag value. The match condition can be equals, not equals, or any value. If you select any value, you do not need to enter a tag value, and a resource is considered a match as long as the tag key is attached to it.
-
Each time a backup policy runs, Cloud Backup performs the following tag matching checks:
Automatically associate newly matched data sources: when a new resource is bound to the tag (or if you select all resources), the backup policy automatically associates the resource, which is then periodically backed up starting from the next backup time point.
Automatically adjust associated resources: for data sources already bound to the backup policy, Cloud Backup checks whether they still match the tags required by the policy. If a data source no longer matches the current tags, the backup policy automatically disassociates it, and the resource will no longer be backed up starting from the next backup time point.
Supported scope and limits
The Associate Resource Tag feature applies only to ECS instance backup, ECS File Backup Standard, OSS backup, Alibaba Cloud NAS backup, Tablestore backup, and CPFS (Sailfish) backup.
You can add up to eight resource cards, and each card can contain up to 30 tags.
If the specified account includes other member accounts or all accounts, tag keys and tag values must be manually entered instead of selected from a drop-down list. If only the current account is selected, tag keys and tag values can be selected from a drop-down list or manually entered.
You can configure tags only on the Policy Center page in the Cloud Backup console. Although you can create or edit backup policies on other data source pages, those pages do not support tag editing.
Notes
Cloud Backup automatically creates paid backup plans for resources matched by tags. These backup plans are not covered by the 30-day free trial offered for OSS, NAS, and Tablestore. To use the free trial, create a free backup plan for an individual resource, such as an OSS bucket, in the resource list in the left pane of the console.
When a tag is unbound from a resource, the backup policy automatically disassociates the resource, and the resource will no longer be backed up starting from the next backup time point.
If you modify any parameter of a backup plan created by a backup policy, the resources covered by the backup plan become manually associated with the backup policy instead of automatically associated by tags, and they are no longer affected by tag value changes in the policy.
Manual association takes precedence over tag-based automatic association. Within the same backup policy, resources that are already manually associated do not generate duplicate backup plans when they match the tags, and the detection result displays a message similar to "N resources are manually associated with this backup policy and will not be associated by tags again." If you manually associate a resource that already matches the tags, an error is returned. Associations between different backup policies are independent of each other, and tag-based automatic association and manual association from different accounts do not affect each other.
If the authorization of a specified account becomes invalid, for example, when the account is removed from cross-account backup management, Detect Now fails, and a message similar to "Failed to detect resources of account xxx (UID). Reason: ..." appears. In this case, existing backup plans are not paused, and Cloud Backup automatically retries in each run. When you edit the policy, you must delete the tag association configuration of the invalid account before you can save the policy.
When you associate resources by configuring tags in a backup policy, you cannot specify fine-grained backup content. To customize the backup content, such as specific file directories on an ECS instance or a specific prefix in an OSS bucket, configure the backup content in a backup plan.
-
When ECS files are automatically associated with a backup policy by resource tags, the ECS File Backup Standard client is automatically installed during backup, and you do not need to install it manually. The automatically installed ECS File Backup Standard client is automatically uninstalled when both of the following conditions are met:
The ECS files are disassociated from all backup policies.
All backup points of the ECS files are deleted or released upon expiration.
How it works
-
A backup policy supports both manual resource association and automatic resource association by resource tags.
A resource can be associated with the same backup policy only once.
If you edit a backup plan, the association changes from automatic to manual.
When you configure tags in a backup policy to associate resources, different resources are joined by OR logic, while tags are joined by AND logic.
-
Each time a backup policy runs, it queries all resources within the specified account scope that match the resource tags, and automatically associates or disassociates resources with the backup policy. Changes to the account scope, including accounts added to or removed from cross-account backup management, take effect at the next policy run.
If a resource matches the resource tags and is not associated with the backup policy, the resource is backed up in this run and automatically associated with the backup policy.
If a resource matches the resource tags and is already associated with the backup policy, the resource is backed up in this run, and the association with the backup policy is retained.
If a resource does not match the resource tags and is not associated with the backup policy, the resource is not backed up in this run.
If a resource does not match the resource tags and was automatically associated with the backup policy, the resource is not backed up in this run, and the association with the backup policy is automatically removed.
If a resource does not match the resource tags and was manually associated with the backup policy, the resource is backed up in this run, and the association with the backup policy is retained.
-
A backup policy queries whether your resources match the resource tags by calling the resource query API of the resource services and the tag query API of Resource Management. Cloud Backup automatically creates service-linked roles to obtain access to your resources:
To automatically back up ECS files and ECS instances by resource tags, Cloud Backup automatically creates the service-linked role AliyunServiceRoleForHbrEcsBackup.
To automatically back up OSS by resource tags, Cloud Backup automatically creates the service-linked role AliyunServiceRoleForHbrOssBackup.
To automatically back up NAS by resource tags, Cloud Backup automatically creates the service-linked role AliyunServiceRoleForHbrNasBackup.
To automatically back up CPFS (Sailfish) by resource tags, Cloud Backup automatically creates the service-linked role AliyunServiceRoleForHbrNasBackup.
To automatically back up Tablestore by resource tags, Cloud Backup automatically creates the service-linked role AliyunServiceRoleForHbrOtsBackup.
If a resource matches the tags of multiple backup policies, the resource is backed up by all of these backup policies.
-
Resources automatically associated by resource tags are backed up based on default settings.
-
ECS files: all files on the ECS instance except the system directories are backed up, and traffic shaping is disabled. The system directories include:
Windows
Windows\
python27\
Program Files (x86)\
Program Files\
ProgramData\
Boot\
$RECYCLE.BIN\
System Volume Information\
Users\Administrator\NTUSER.DAT
pagefile.sys
Users\Administrator\ntuser.dat.LOG1
Linux
/bin/
/usr/bin/
/sbin/
/boot/
/proc/
/sys/
/srv/
/lib/
/selinux/
/usr/sbin/
/run/
/lib32/
/lib64/
/lost+found/
OSS: all files in the bucket are backed up, and the OSS inventory feature is not used.
NAS: all files in the root directory of the file system are backed up.
Tablestore: all data tables in the Tablestore instance are backed up, and traffic shaping is disabled.
ECS instances: all cloud disks on the ECS instance are backed up, and the application consistency option is disabled.
-
Get started
-
When you create or edit a backup policy, you can associate resources in bulk based on tags, but you cannot specify fine-grained backup content. To customize the backup content, configure it in a backup plan. For more information, see Policy Center.

In the Policy Center list, click
on the left of a target backup policy to view the associated data sources.
-
Before you can save a backup policy, you must click Detect Now in the Resource Hit Detection area and confirm the matched resources. After you edit the policy content again, you must click Detect Now again.
After detection is complete, the console displays the message "Detected N resources that will be automatically backed up by this policy." Hover over View Details in the message to view the list of matched resources, which contains four columns: cross-account type, Alibaba Cloud account ID, resource name, and resource ID. Click Download Current Table Data to download the list as a CSV file. If the detection result contains more than 100 resources, the console displays the total number of matched resources but only the first 100 resources. To view the complete resource list, log on to the product console of the corresponding account.
To unbind tags from a resource, see Unbind resource tags.