Object Storage Service (OSS) uses a flat structure instead of the hierarchical structure which is used by traditional file systems to store objects. All data in OSS is stored as objects in buckets. Objects are the basic unit for data storage in OSS. OSS uses a key (name) to uniquely identify an object.
Naming conventions
The name of an object must comply with the following conventions:
The name must be encoded in UTF-8.
The name must be 1 to 1,023 bytes in length.
The prefix cannot start with a forward slash (/) or a backslash (\).
The name is case-sensitive.
Naming guidelines
We recommend that you name objects based on the following guidelines:
Use a meaningful name. The name of an object should reflect the content and purpose of the object. It should be easy to find and understand. For example, you can use information, such as the file name, date, and user ID, as the name of the object.
Use a unique name. The name of an object should be globally unique to prevent naming conflicts. You can include information, such as a random number or UUID, in the name of the object to ensure that the name is unique.
Use prefixes to organize data. A prefix is part of an object name and can be used to create a hierarchy for the object. For example, you can use information, such as the date, user ID, and region, as a prefix to better organize and manage data.
Examples
The key of an object varies based on the location in which the object is stored. The following table describes the keys of two objects that are stored in different locations of a bucket.
Object | Key |
An object that is named exampleobject.txt and is stored in the root directory of a bucket named examplebucket | exampleobject.txt |
An object that is named exampleobject.jpg and is stored in the destdir directory within the root directory of a bucket named examplebucket | destdir/exampleobject.jpg |