Tags allow you to group and manage ECI instances, simplifying filtering and batch operations.
Background information
When using OpenAPI or the Elastic Container Instance console to manage ECI instances, use tags to label instances that share management or business requirements.
Note the following limits on tags:
-
Each tag consists of a key-value pair. The tag key for a resource must be unique.
-
Tags are region-specific.
-
Each ECI instance can have a maximum of 20 tags.
-
You cannot delete tags individually.
NoteDeleting an ECI instance also deletes its tags.
Create an ECI instance with tags
API
When you call the CreateContainerGroup API operation to create an ECI instance, use the Tag parameter to set tags. The following table describes the related parameters. For more information, see CreateContainerGroup.
|
Parameter |
Type |
Example |
Description |
|
Tag.N.Key |
String |
version |
The tag key. The value of N ranges from 1 to 20. The key cannot be an empty string and must be unique. It can be up to 64 characters in length and cannot start with |
|
Tag.N.Value |
String |
2.0 |
The tag value. The value of N ranges from 1 to 20. The value can be an empty string. It can be up to 128 characters in length, cannot start with |
Console
When you create an ECI instance on the Elastic Container Instance buy page, add tags in the Other Settings section.
For example, add a tag with the key version and value 2.0, and another tag with the key type and value eci. To add more tags, click + Add Tag.
Query ECI instance tags
API
Calling the DescribeContainerGroups API to query an ECI instance returns its bound tags in the Tags field of the response. In the response, Key is the tag key and Value is the tag value. For more information, see DescribeContainerGroups.
Console
In the Elastic Container Instance console, on the Container Groups page, find the target instance and hover the pointer over the tag icon in the Tags column to view its bound tags.
Filter ECI instances by tags
After adding tags to ECI instances, you can use them for filtering and authorization.
API
When you call the DescribeContainerGroups API operation to query ECI instances, pass Tag-related parameters to filter the results. For more information, see DescribeContainerGroups.
Console
In the Elastic Container Instance console, on the Container Groups page, filter ECI instances by tags.
In the search bar, select the Elastic Container Group Tag filter and enter a key-value pair, such as version:2.0. The page then displays only the ECI instances that match this tag condition.
If you use RAM users to manage ECI resources, you can use tag-based authorization. This lets you grant a RAM user permissions to operate only on ECI resources with specific tags. For more information, see Authorize RAM users based on tags.
Update ECI instance tags
Before updating tags, first query which tags are bound to the ECI instance. During an update, you can only add new tags or update existing ones; you cannot delete tags.
API
When you call the UpdateContainerGroup API operation to update an ECI instance, pass new Tag parameters to update its tags. The following table describes the related parameters. For more information, see UpdateContainerGroup.
|
Parameter |
Type |
Example |
Description |
|
Tag.N.Key |
String |
version |
The tag key. The value of N ranges from 1 to 20. The key cannot be an empty string and must be unique. It can be up to 64 characters in length and cannot start with |
|
Tag.N.Value |
String |
2.0 |
The tag value. The value of N ranges from 1 to 20. The value can be an empty string. It can be up to 128 characters in length, cannot start with |
Console
To update the tags for an existing ECI instance, go to the Container Groups page in the Elastic Container Instance console, find the instance, and modify its tags.
In the tag configuration area, enter tag key-value pairs. For example, add a tag with the key version and value 3.0, and another tag with the key type and value eci. Click + Add Tag to add more tags. You can add up to 20 tags in total.