Configuring Object Metadata

Each object has the data, key, and metadata. When you create an object, specify an object key because it uniquely identifies the object in the bucket. A key name is a sequence of Unicode characters, and its UTF-8 code contains a maximum of 1024 bytes. Object metadata is a key-value pair. When you upload an object, you can set its metadata. After the object is uploaded, you cannot modify its metadata. The only way to modify object metadata is to create an object copy and set metadata.

Naming Rules of Object Keys

Although any UTF-8 characters can be used in an object key name, the following best practices of naming object keys can help maximize the object keys' compatibility with other applications. Ways to analyze special characters vary with applications. The following guidelines help object key names substantially meet the requirements of DNS, web security characters, XML analyzers and other APIs.

The following character sets can be freely used in key names.

Letters and digits (0-9 a-z A-Z)
Special characters including !-_.*'

Note that the OBS data model is a layer structure. You create a bucket and the bucket stores objects. No sub-buckets or sub-folders exist in the structure. However, you can use key name prefixes and separators to deduce the logical structure like OBS Console does. The folder concept is available on OBS Console.

Object Metadata

Object metadata consists of system metadata and user-defined metadata.

System metadata: OBS reserves a set of system metadata for each object in a bucket. OBS processes the system metadata based on requirements. For example, OBS reserves object metadata such as creation time and size, and the metadata is part of object management.

User-defined metadata: When uploading data elements, you can allocate metadata to the data elements. When you send a PUT or POST request to create an object, you provide the optional information in the form of key-value pairs. When you use REST APIs to upload objects, the optional user-defined metadata names must start with x-amz-meta- to differentiate them from other HTTP headers. When you use REST APIs to search for data elements, the prefix x-amz-meta- is returned.

  • When you use REST APIs to search for metadata, OBS lists namesake (case insensitive) headers and separates them with commas (,) in the list. If metadata contains characters that cannot be printed, the metadata is not returned. However, the header x-amz-missing-meta and the number of metadata items that cannot be printed are returned together.
  • OBS uses lowercase letters to store user-defined metadata. When you use REST and UTF-8 or send a POST request to upload objects based on browsers, key-value pairs must comply with US-ASCII.
  • The maximum size of a PUT request header is 8 KB. In a PUT request header, the maximum size of user-defined metadata is 2 KB. User-defined metadata is a group of key-value pairs. The size of user-defined metadata is measured by the total bytes in the UTF-8 code of each key and value.