Creates and attaches tags. You can call the TagResources operation to uniformly create and attach tags to your Auto Scaling resources, streamlining resource management. This capability empowers you to categorize resources based on tags, thereby enhancing the overall efficiency of resource allocation and utilization.
Operation description
-
You can attach up to 20 tags to a scaling group.
**
Note Before you attach tags to a specific Auto Scaling resource, Alibaba Cloud automatically verifies the current number of tags attached to that resource. In the event the proposed addition would exceed the maximum allowed number of tags, an error message will be promptly returned after you call this operation.
-
If you set
Tags.Propagate
totrue
, any tags attached to your scaling group will be automatically propagated to new instances that are subsequently created in the scaling group, without affecting existing instances. -
If both the scaling configuration and the scaling group have tags attached, and tag propagation from the scaling group is enabled, the tags of newly created instances comply with the following rules:
- Instances set to join the scaling group will inherit the following tags: tags attached to the scaling configuration that initiates the instance creation and tags attached to the scaling group that are allowed to propagate to these instances upon instance creation.
- If the tag keys of the scaling configuration and those attached to the scaling group and propagated to the instances are identical, the tags attached to the scaling group and propagated to the instances will be overwritten by the tags of the scaling configuration.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ess:TagResources | update | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the resource. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
ResourceType | string | Yes | The resource type. Set the value to scalinggroup. | scalinggroup |
ResourceIds | array | Yes | The IDs of the Auto Scaling resources. You can specify 1 to 50 resource IDs. | |
string | Yes | The ID of the Auto Scaling resource. | asg-2zej7nf7hea77k5a**** | |
Tags | array<object> | Yes | Details of the tags. | |
object | Yes | |||
Key | string | No | The key of the tag that you want to add to the Auto Scaling resource. You cannot specify empty strings as tag keys. The tag key must be 1 to 128 characters in length and cannot contain | TestKey |
Value | string | No | The value of the tag that you want to add to the Auto Scaling resource. You can specify empty strings as tag values. The tag value must be 0 to 128 characters in length and cannot contain | TestValue |
Propagate | boolean | No | Specifies whether to propagate the tag that you want to add. Valid values:
Default value: false. | false |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "74C4E313-8570-479F-8791-DC25360D****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|