Each tag is a key-value pair and can be used to mark elastic container instances. You can use tags to manage elastic container instances by group to perform searches and batch operations with ease.
Background information
If you use or manage elastic container instances by calling API operations or by using the Elastic Container Instance console, you can use tags to group instances that share the same management or business requirements for easy search and operations.
When you use tags, take note of the following limits:
Each tag consists of a tag key and a tag value. The tag key must be unique.
Tag information cannot be shared across regions.
Up to 20 tags can be added to a single elastic container instance.
Tags cannot be separately deleted.
NoteWhen an elastic container instance is deleted, the tags added to the instance are also deleted.
Create an elastic container instance that has tags
Call an API operation
When you call the CreateContainerGroup operation to create an elastic container instance, you can use the tag-related parameters to specify tags. The following table describes the parameters. For more information, see CreateContainerGroup.
Parameter | Type | Example | Description |
---|---|---|---|
Tag.N.Key | String | version | The key of tag N. Valid values of N: 1 to 20. The tag key cannot be an empty string and must be unique. It can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://. |
Tag.N.Value | String | 2.0 | The value of tag N. Valid values of N: 1 to 20. The tag value can be an empty string. It can be up to 128 characters in length. It cannot start with acs: or contain http:// or https://. |
Use the console
When you create elastic container instances on the instance buy page in the Elastic Container Instance console, you can add tags to the instances in the Other Settings step, as shown in the following figure.

Query the tags of an elastic container instance
Call an API operation
When you call the DescribeContainerGroups operation to query elastic container instances, the Tags response parameters indicate the tags of the instances. The Key response parameter indicates the tag key, and the Value response parameter indicates the tag value. For more information, see DescribeContainerGroups.
Use the console
Go to the Elastic Container Instance page in the Elastic Container Instance console. Find the instance whose tags you want to query and move the pointer over the icon in the Tag column to view the tags of the instance, as shown in the following figure.

Use tags to filter elastic container instances
After you add tags to elastic container instances, you can use the tags to search for or authenticate to the instances.
Call an API operation
When you call the DescribeContainerGroups operation to query elastic container instances, you can use the tag-related parameters to filter instances. For more information, see DescribeContainerGroups.
Use the console
On the Elastic Container Instance page in the Elastic Container Instance console, you can use tags to filter elastic container instances.

If you use a Resource Access Management (RAM) user to manage Elastic Container Instance resources, you can use tags to limit users to perform operations only on resources that have specific tags. For more information, see Authenticate RAM users based on tags.
Update the tags of an elastic container instance
Before you update tags for an elastic container instance, you can first query the tags that are added to the instance. When you update tags for an elastic container instance, you can only update the existing tags or add new tags. Tags cannot be deleted from elastic container instances and the number of tags on each elastic container instance cannot be reduced.
Call an API operation
When you call the UpdateContainerGroup operation to update an elastic container instance, you can use the tag-related parameters to update tags. The following table describes the parameters. For more information, see UpdateContainerGroup.
Parameter | Type | Example | Description |
---|---|---|---|
Tag.N.Key | String | version | The key of tag N. Valid values of N: 1 to 20. The tag key cannot be an empty string and must be unique. It can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://. |
Tag.N.Value | String | 2.0 | The value of tag N. Valid values of N: 1 to 20. The tag value can be an empty string. It can be up to 128 characters in length. It cannot start with acs: or contain http:// or https://. |
Use the console
On the Elastic Container Instance page in the Elastic Container Instance console, you can select a created instance and update its tags, as shown in the following figure.
