Objects
Objects are hosted in buckets and contain user data in the format it was uploaded in.
An object ID is a string key.
Along with the object, Object Storage stores user and system metadata.
Object Storage allows you to store objects in storages belonging to various classes depending on your requirements for the storage duration and frequency of object operations. For more information, see Storage class.
Object Storage supports the following operations with objects:
- Uploading an object to a storage.
- Downloading an object from a storage.
- Copying an object within a storage, e.g., from one bucket to another.
- Deleting an object.
- Partial object update in a storage.
You can also combine these operations using the tools.
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
A key is an ID of an object in a bucket.
Objects are stored in a flat structure, although GUI-based tools allow you to use Object Storage as a hierarchical file system. Hierarchical view is possible because keys can be written as paths in a file system, e.g., 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 these characters:
: * ? " < > | !
.
The following characters are safe to use in a key: [a-zA-Z0-9]
, -
, _
, /
, \
. Other characters may cause various issues in Object Storage.
Directory
There are no directories in Object Storage, but GUI-based file management clients, such as CyberDuck and the Object Storage interface in the Yandex Cloud management console, can emulate them. Such an emulated directory is a zero-size object. 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
folder.
Each tool manages objects and directories according to its own logic, which is described in the respective documentation.
Note
Deleting folders with objects is an asynchronous operation. Once it starts, Object Storage prepares a list of objects to delete, and then deletes them. If during the process you upload an object to Object Storage to a directory marked for deletion, the object will upload successfully. After both operations in Object Storage are complete, the directory marked for deletion will remain and contain 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:
http(s)://<bucket>.storage.yandexcloud.net/<key>
https://storage.yandexcloud.net/<bucket>/<key>
- For a bucket with restricted access:
http(s)://<bucket>.storage.yandexcloud.net/<key>?<parameters>
https://storage.yandexcloud.net/<bucket>/<key>?<parameters>
Where:
<bucket>
: Bucket name.<key>
: Key (file path).<parameters>
: Additional parameters for accessing a bucket with restricted access, e.g., a signature and validity period.
You can get files from a publicly available bucket using a public link via both HTTP and HTTPS even if the bucket has no website hosting configured. In this case, a cloud-level certificate from GlobalSign
For buckets with restricted access, the service generates temporary pre-signed URLs that allow you to download an object even from a bucket with restricted access. You can read more about pre-signed URLs, their generation, and their use here.
Note
When using a URL in http(s)://<bucket_name>.storage.yandexcloud.net
format, the HTTPS protocol is available for the bucket only if the bucket name does not contain dots. For example:
https://example.storage.yandexcloud.net
HTTPS is available for this bucket.http://example.ru.storage.yandexcloud.net
HTTPS is not available for this bucket.
This is because Object Storage uses Wildcard certificates
To provide HTTPS support for a bucket with a dot in the name, upload your own security certificate to Object Storage.
Note
If you use AWS SDK for .NET, access the s3.yandexcloud.net
host.
Metadata
Metadata is stored with the object in the form of key-value
pairs.
This can be either system or user metadata.
System metadata
System metadata is defined by Object Storage.
Key | Description |
---|---|
Date |
Date and time the request to upload an object to Object Storage was sent. |
Content-Length |
Object size in bytes. |
Last-Modified |
Date the object was created or last modified. |
Content-MD5 |
Object MD5 hash value, Base64-encoded. |
Cache-Control |
Value of the Cache-Control HTTP header provided by the client when saving the object to the bucket. Afterwards, Object Storage 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 means the object expires 200 seconds after the client receives it. You can read more about it in RFC 7234 |
Expires |
Value of the Expires HTTP header provided by the client when saving the object to the bucket. Afterwards, Object Storage 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 means the object expires at 8 pm GMT on April 15, 2020. You can read more about it in RFC 7234 |
User-defined metadata
When uploading an object to Object Storage, you can provide its metadata in the form of key-value
pairs.
In an Amazon S3-compatible HTTP API, metadata is provided as HTTP headers. The header name must start with X-Amz-Meta-
. When an object is requested via the HTTP API, Object Storage returns metadata as HTTP headers with the same prefix.
Metadata keys must consist of ASCII charactersX-Amz-Meta-foo-bar_baz
→ X-Amz-Meta-Foo-Bar_baz
, where Foo-Bar_baz
is the key of the metadata that will be saved with the object.
Note
The PUT request header must not exceed 8 KB. The maximum size of user-defined metadata in this header is 2 KB.
For more information, see Managing object custom metadata.