Updated on 2025-07-31 GMT+08:00

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 can be 36 characters long at most and cannot contain the following special characters: = * < > \ , | / It must be case sensitive and unique, and cannot start or end with a space. It cannot be left blank.
  • Tag value constraints:
    • A tag value can be 43 characters long at most and cannot contain the following special characters: = * < > \ , | / It must be case sensitive and cannot start or end with a space. It can be left blank.

Important Notes

  • Object tags are now during open beta testing and can be used for free. Once the testing period is over, you will be billed for using them.
  • 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.
  • Tags cannot be added to files in parallel file systems.
  • Currently, object tags cannot be used in IAM permissions or bucket policies.

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>

Ways to Configure Object Tags

You can use OBS Console or APIs to configure object tags.

Related Operations

In the tag list, click Edit to change the tag value or click Delete to remove the tag.