All Products
Search
Document Center

Auto Scaling:TagResources

Last Updated:Jun 24, 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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

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****
Tagsobject []Yes

Details of the tags.

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