An object is the basic unit of COS and is stored in a bucket just like a photo stored in an album. You can manage objects in different ways including Tencent Cloud Console, APIs, and SDKs. An object is named in the format of
<ObjectKey> in API and SDK examples.
Objects can be uploaded via simple upload or multipart upload(https://intl.cloud.tencent.com/document/product/436/14112).
- Use simple upload for objects less than 5 GB.
- Multipart upload is limited to no more than 10,000 parts (less than 5 GB per part) and a maximum object size of 48.82 TB.
Each object consists of an object key (ObjectKey), an object value (Value), and object metadata (Metadata).
You can configure objects in the console. For more information, see:
An object in COS must contain a valid ObjectKey, which is the unique identifier of an object in a bucket.
For example, in an object's access address
examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/folder/picture.jpg, the ObjectKey is
*), and a combination of them.
The following are examples of valid key names:
Some characters may need to be URL encoded or referenced in the hexadecimal format. Some of these are non-printable characters and your browser might not handle them, which also requires special handling, as shown below:
|ASCII character ranges: 00-1F hexadecimal (0-31 decimal) and 7F (127 decimal)||(space)|
There are also some characters that require significant special handling to maintain consistency across all applications, so it is recommended to avoid them directly, as shown below:
The access address of the object consists of a bucket access address and an object key, in the format of
[bucket domain name]/[object key].
For example, when you upload the
exampleobject.txt object to the
examplebucket-1250000000 bucket in Guangzhou (South China), the access address for
As COS comes with no folders or directories, it will not create a
project folder for uploading the object
project/a.txt. To make it easier for you to get started, COS simulates the display mode of "folder" or "directory" in the console and graphical tools such as COS browser. This is implemented by creating an empty object with a key value of
project/ and displaying it as a traditional folder.
For example, when you upload the object
project/doc/a.txt via APIs or SDKs, the delimiter
/ simulates the display mode of "folder", and you can see the folders
doc in the console. The folder
doc is displayed under the folder
project and contains the file
Objects in the bucket are evenly distributed among distributed clusters. Therefore, you cannot directly get the size of all objects with a specified object key prefix. Instead, you can accumulate the size of each object to get the full size.
Deleting folders and directories is relatively complicated, as shown below:
||All objects with the object key prefix
|API and SDK||Object
Metadata (aka HTTP header) is a set of key-value pairs in an object. It is the string sent by the server before the server sends HTML data using HTTP protocol to the browser. Modifying the HTTP header when uploading an object can alter page response forms or communicate configuration information, such as modifying caching time.
There are two kinds of metadata: system metadata and user-defined metadata.
Modifying an object's HTTP header does not modify the object itself.
provides attribute information about the object, such as upload time or modification time.
|Content-Length||Length in bytes of the content of an HTTP request defined in RFC 2616|
|Last-Modified||The creation date or last modified date (whichever is later) of the object|
|x-cos-version-id||Object version. A version ID of the object is returned when you enable versioning on the bucket.|
|ETag||Indicates the MD5 value of an object uploaded by calling PUT Object, or the unique ID of an object uploaded by multipart upload or a historical version of API, which cannot perform check though ||
This refers to the object's custom parameters, such as Content-Type, Cache-Control, Expires, and x-cos-meta-*. For more information, see Custom Object Headers.
|Cache-Control||The caching policy as defined in RFC 2616; saved as part of object metadata|
|File name/encoding format/content type (MIME) as defined in RFC 2616; saved as part of object metadata|
|Expires||The cache expiration time as defined in RFC 2616; saved as part of object metadata|
|x-cos-acl||Defines ACL attributes of the object. Valid values: private, public-read-write, public-read; Default: private|
|x-cos-grant-*||Grants the grantee permissions|
|x-cos-meta-*||User-defined headers; returned as part of object metadata with a size up to 2 K|
|x-cos-storage-class||Storage class of the object; enumerated values: STANDARD, STANDARD_IA, ARCHIVE; default: STANDARD|
|x-cos-server-side-encryption||Specifies whether to enable server-side encryption for the object and the encryption method|
COS has sub-resources that are associated with buckets and objects. Sub-resources belong to objects, so they do not exist independently; instead, they are always associated with other entities such as objects or buckets. An access control list (ACL) is the access control information list for a specific object, which is a sub-resource of a COS object.
An ACL contains an authorization list that identifies authorized users and the granted licenses to implement access control on the object. When you create an object, ACL identifies the object owner who can fully control the object. The user can retrieve the object ACL or replace it with a new authorization list.
To update an ACL, you can only do so by replacing it.
COS supports setting two permissions for objects: Public Permissions and User Permissions.
Public Permissions: includes Inherit Permission, Private Read/Write, and Public Read/Private Write.
User Permissions: the root account has all the permissions of the object by default (i.e. full control). In COS, sub-accounts can be added to read/write data, read/write permissions, and have the full control permission.
Allow public access to a specified object in a Private Read/Write bucket or set a required authentication for a specific object in a Public Read/Write bucket.