forked from docs/doc-exports
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
8.3 KiB
8.3 KiB
Adding Tags to an Object
Tag Rules
Tags can be added to objects to categorize storage. You can add tags to new objects when you upload them or add them to existing objects.
An object tag is a key-value pair. To use tags, follow the rules below:
- An object can have up to 10 tags.
- Tag key constraints:
- If there are multiple tags specified for an object, each tag key must be unique.
- A tag key must contain 1 to 36 characters and be case sensitive.
- A tag key can contain only digits, letters, underscores (_), and hyphens (-).
- Tag value constraints:
- A tag value can contain 0 to 43 characters and must be case sensitive.
- A tag value can contain only digits, letters, underscores (_), and hyphens (-).
Important Notes
- To read or write object tags, you must have required permissions. Such permissions can be granted using bucket policies. By default, only the object owner can read or write the object's tags.
- During cross-region replication, tags of source objects are not copied.
- Tags cannot be added to files in parallel file systems.
Scenarios
Specifying object tags in a lifecycle rule
In a lifecycle configuration, you can specify filter conditions to identify the objects which the lifecycle rule applies to. A filter can be defined based on an object name prefix, an object tag, or both. The following rule deletes objects with the texta/ prefix and with tags key1/value1 and key2/value2 120 days after their creation.
<LifecycleConfiguration>
<Rule>
<ID>sample-rule</ID>
<Filter>
<And>
<Prefix>texta/</Prefix>
<Tag>
<Key>key1</Key>
<Value>value1</Value>
</Tag>
<Tag>
<Key>key2</Key>
<Value>value2</Value>
</Tag>
</And>
</Filter>
<Status>Enabled</Status>
<Expiration>
<Days>120</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
Related Operations
In the tag list, click Edit to change the tag value or click Delete to remove the tag.
Parent topic: Tags