upload method
Uploads an object and its metadata to Yandex Object Storage.
Note
Object Storage doesn't block objects for writing and can accept multiple requests to write to the same object in parallel, but the user can only get the latest object saved from Object Storage by default. To ensure that the history is saved when objects are overwritten or deleted, enable versioning.
To make sure an object is passed via the network without any corruption, use the Content-MD5
header. Object Storage calculates the MD5
value for a saved object and, if the calculated MD5
value does not match the one passed in the header, it returns an error. You can also perform this check on the client side by comparing the ETag
from the Object Storage response with the precalculated MD5
value.
Warning
If default object locks are configured in the bucket, the Content-MD5
header is required.
Request
PUT /{bucket}/{key} HTTP/2
Path parameters
Parameter | Description |
---|---|
bucket |
Bucket name. |
key |
Object key. ID for saving the object in Object Storage. |
Headers
Use the appropriate common headers in requests.
You can also use the headers listed in the table below.
Header | Description |
---|---|
X-Amz-Meta-* |
User-defined metadata. Object Storage transforms all headers starting with X-Amz-Meta- as follows: X-Amz-Meta-foo-bar_baz → X-Amz-Meta-Foo-Bar_baz .Total user-defined header size must not exceed 2 KB. The size of user-defined data is determined as the length of the UTF-8 encoded string. The header names and their values are included when calculating the size. |
X-Amz-Storage-Class |
Object storage class. Possible values:
|
X-Amz-Server-Side-Encryption |
The encryption algorithm of an uploaded object. Possible values: aws:kms . |
X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id |
The ID of the KMS key for encrypting an uploaded object. |
X-Amz-Object-Lock-Mode |
Type of retention put on the object (if the bucket is versioned and object lock is enabled in it):
On an object version, you can put only retention (the headers |
X-Amz-Object-Lock-Retain-Until-Date |
Date and time until which the object is retained, specified in any format described in the HTTP standardMon, 12 Dec 2022 09:00:00 GMT . Specify it only with the X-Amz-Object-Lock-Mode header. |
X-Amz-Object-Lock-Legal-Hold |
Type of legal hold put on the object (if the bucket is versioned and object lock is enabled in it):
On an object version, you can put only retention (the headers |
By using the headers listed below, you can set the ACL for an object to be uploaded.
Header | Description |
---|---|
X-Amz-Acl |
Sets a predefined ACL for an object. |
X-Amz-Grant-Read |
Grants the access grantee object read permission. |
X-Amz-Grant-Read-Acp |
Grants the access grantee object ACL read permission. |
X-Amz-Grant-Write-Acp |
Grants the access grantee object ACL write permission. |
X-Amz-Grant-Full-Control |
Grants the access grantee the following permissions: READ , WRITE , READ_ACP , and WRITE_ACP for an object. |
The value for an X-Amz-Grant-*
header is a comma-separated list of access grantees. Each access grantee is identified in a structure like <access_grantee_type>:<access_grantee_ID>
. Object Storage supports the following types of access grantees:
id
: Access grantee is a cloud user.uri
: Access grantee is a public group.
For example:
X-Amz-Grant-Read: uri="http://acs.amazonaws.com/groups/s3/AuthenticatedUsers"
Response
Headers
Responses can only contain common response headers.
Response codes
For a list of possible responses, see Responses.