Object Storage Service (OSS) uses a flat structure instead of a hierarchical structure that is used by 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 of an object must be encoded in UTF-8.
  • The name must be 1 to 1,023 characters in length.
  • The name 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 avoid 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 with 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.

ObjectKey
An object that is named exampleobject.txt and is stored in the root directory of a bucket named examplebucketexampleobject.txt
An object that is named exampleobject.jpg and is stored in the destdir directory within the root directory of a bucket named examplebucketdestdir/exampleobject.jpg