Objects
Objects are hosted in buckets and contain user data in the format it was uploaded in.
The object ID is the string key.
Object Storage stores user-defined and system metadata along with the object.
Object Storage lets you store objects in standard and cold storage. For more information, see Storage class.
Object Storage supports the following operations with objects:
- Uploading an object to storage
- Downloading an object from storage.
- Copying an object inside the storage (for example, from one bucket to another).
All other operations that can be performed using tools are combinations of the ones given above.
You can configure lifecycles for bucket objects.
Object Storage restricts the size of objects and their metadata. For more information, see Quotas and limits in Object Storage).
Key
The key is the ID of an object in a bucket.
Objects are stored in a flat structure, but GUI-based tools let you use Object Storage as a hierarchical file system. Hierarchical view is possible because keys can be written as paths in a file system (for example, top_level_prefix/subprefix/text_data.txt
). In the Yandex Cloud management console, prefixes are called folders.
A key must:
- Be UTF-8 encoded.
- Be less than 1024 bytes in size.
- Not contain the characters
: * ? " < > | !
.
The following characters are safe to use in a key: [a-zA-Z0-9]
, -
, _
, /
, \
. Other characters may cause various problems in Object Storage.
Directory
There are no directories in Object Storage, but GUI-based file management clients like CyberDuck and the Object Storage interface in the Yandex Cloud management console emulate them. A zero-size object serves as a directory. Its key is included as a prefix in the keys of other objects. For example, an object with the x
key and zero size is a directory in the management console, while an object with the x/y.txt
key is the y.txt
object located in the x
directory.
Each tool manages objects and directories according to their own logic, which is described in their respective documentation.
Note
Deleting directories with objects is an asynchronous operation. At the start of the operation, Object Storage prepares a list of objects to delete and then deletes them. If during the deletion process, you upload an object to Object Storage that should be in the directory being deleted, the object will still be uploaded successfully. After both operations in Object Storage are complete, you're left with the directory that was supposed to be deleted and the newly uploaded file.
Object URL
You can specify a link to a bucket object in one of the following formats:
- For a bucket with public access:
https://<bucket>.storage.yandexcloud.net/<key>
https://storage.yandexcloud.net/<bucket>/<key>
- For a bucket with restricted access:
https://storage.yandexcloud.net/<bucket>/<key>?<parameters>
https://<bucket>.storage.yandexcloud.net/<key>?<parameters>
Where:
bucket
: Bucket name.key
: Key (file path).parameters
: Additional parameters for accessing a bucket with restricted access. For example, a signature and validity period.
For buckets with restricted access, signed links are generated by the service and let you temporarily download an object even from a bucket with restricted access. Read more about pre-signed urls.
Note
If you use the AWS SDK for .NET, access the s3.yandexcloud.net
host.
Metadata
Metadata is stored with an object as name-value
pairs.
Metadata can be system or user-defined.
System metadata
System metadata is defined by Object Storage.
Name | Description |
---|---|
Date |
Date and time a request is sent to upload an object to Object Storage. |
Content-Length |
Object size in bytes. |
Last-Modified |
Date when the object was created or last modified. |
Content-MD5 |
Object MD5 hash value, base64 encoded. |
Cache-Control |
The value of the Cache-Control HTTP header passed by the client when saving the object to the bucket. Object Storage later returns this header to clients when responding to a request for an object or its metadata.For example, the Cache-Control: max-age=200 header indicates that the object expires 200 seconds after the client receives it. Read more about this header in RFC 7234. |
Expires |
The value of the Expires HTTP header passed by the client when saving the object to the bucket. Object Storage later returns this header to clients when responding to a request for an object or its metadata. For example, the Expires: Thu, 15 Apr 2020 20:00:00 GMT header indicates that the object expires at 20:00:00 (GMT) on April 15, 2020. Read more about this header in RFC 7234. |
User-defined metadata
When uploading an object to Object Storage, you can pass a set of metadata as a name-value
pair along with the object.
In the Amazon S3-compatible HTTP API, metadata is passed as HTTP headers. The header name must start with x-amz-meta-
. When an object is requested via the HTTP API, Yandex Object Storage returns metadata in the form of HTTP headers with the same prefix.
Metadata names must conform to the HTTP header naming convention and be in lowercase.
Note
The PUT request header must not exceed 8 KB. The maximum size of user-defined metadata in this header is 2 KB.