All Products
Search
Document Center

Auto Scaling:TagResources

Last Updated:Dec 11, 2024

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 to true, 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
ess:TagResourcesupdate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the resource. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
ResourceTypestringYes

The resource type. Set the value to scalinggroup.

scalinggroup
ResourceIdsarrayYes

The IDs of the Auto Scaling resources. You can specify 1 to 50 resource IDs.

stringYes

The ID of the Auto Scaling resource.

asg-2zej7nf7hea77k5a****
Tagsarray<object>Yes

Details of the tags.

objectYes
KeystringNo

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 http:// or https://. The tag key cannot start with acs: or aliyun.

TestKey
ValuestringNo

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 http:// or https://. The tag value cannot start with acs:.

TestValue
PropagatebooleanNo

Specifies whether to propagate the tag that you want to add. Valid values:

  • true: propagates the tag only to instances that are newly created and does not propagate the tag to instances that are already running in the scaling group.
  • false: does not propagate the tag to any instances.

Default value: false.

false

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

74C4E313-8570-479F-8791-DC25360D****

Examples

Sample success responses

JSONformat

{
  "RequestId": "74C4E313-8570-479F-8791-DC25360D****"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history