Available in Classic and VPC
Save an object in a Ncloud Storage bucket.
For a Sub Account user to execute this command, they must have the Change/PutObject action permission.
Syntax
The put-object syntax is as follows:
aws s3api put-object \
--bucket <bucket> \
--key <key> \
[--body <body>] \
[--cache-control <cache-control>] \
[--content-disposition <content-disposition>] \
[--content-encoding <content-encoding>] \
[--content-language <content-language>] \
[--content-length <content-length>] \
[--content-md5 <content-md5>] \
[--content-type <content-type>] \
[--metadata <metadata>] \
[--storage-class <storage-class>] \
[--server-side-encryption <server-side-encryption>] \
[--sse-customer-algorithm <sse-customer-algorithm>] \
[--sse-customer-key <sse-customer-key>] \
[--sse-customer-key-md5 <sse-customer-key-md5>] \
[--object-lock-mode <object-lock-mode>] \
[--object-lock-retain-until-date <object-lock-retain-until-date>] \
[--object-lock-legal-hold-status <object-lock-legal-hold-status>] \
--endpoint-url <endpoint-url>
You can upload objects up to 5 GB in size with a single put operation. For large files of 5 GB or more, use multipart uploads.
Options
This section describes the options available when running put-object.
Required options
The following options are required for put-object.
| Options | Type | Required | Description |
|---|---|---|---|
--bucket |
String | Required | Bucket name |
--key |
String | Required | Object name |
Optional options
These are the optional options for put-object. Options that are not specified will use their default values.
| Options | Type | Required | Description |
|---|---|---|---|
--body |
String | Optional | Path or file of the object |
--cache-control |
String | Optional | Caching behavior |
--content-disposition |
String | Optional | Display format of requested data |
--content-encoding |
String | Optional | Encoding format of requested data |
--content-language |
String | Optional | Request data language |
--content-length |
Long | Optional | Request data size (byte) |
--content-md5 |
String | Optional | Base64-encoded 128-bit MD5 hash of the request data
|
--content-type |
String | Optional | Request data format. |
--metadata |
String | Optional | Metadata to be stored with the object |
--storage-class |
String | Optional | Storage class
|
--server-side-encryption |
String | Optional | Server-side encryption method
|
--sse-customer-algorithm |
String | Optional | User encryption algorithm (AES256) |
--sse-customer-key |
String | Optional | User-provided encryption key |
--sse-customer-key-md5 |
String | Optional | User-provided encryption key's MD5 value |
--object-lock-mode |
String | Optional | Object retention mode
|
--object-lock-retain-until-date |
String | Optional | Object retention expiration date
|
--object-lock-legal-hold-status |
String | Optional | Legal hold status
|
Common options
For information about the options common to all aws subcommands, see Ncloud Storage options.
Examples
If the object upload request is successful, the object's identification information and encryption information are returned.
Command
The following is an example command for uploading an object.
aws s3api put-object --bucket my-test-bucket \
--key img/image.png \
--body image.png \
--endpoint-url=https://kr.ncloudstorage.com
The following is an example command for uploading an object to the Deep Archive Class.
aws s3api put-object --bucket my-test-bucket \
--key img/image2.png \
--body image2.png \
--storage-class DEEP_ARCHIVE \
--endpoint-url=https://kr.ncloudstorage.com
Output
The following is an example output for uploading an object.
{
"ETag": "\"7cb4883d8f0eede455af0738a2d83b4b\"",
"ChecksumCRC32": "35sEXg==",
"ChecksumType": "FULL_OBJECT",
"ServerSideEncryption": "AES256"
}
The following is an example output for uploading an object to the Deep Archive Class.
{
"ETag": "\"a7ee607d2e3b234a891a50b33fc12227\"",
"ChecksumCRC32": "ZfRKhA==",
"ChecksumType": "FULL_OBJECT",
"ServerSideEncryption": "AES256"
}
Related commands
Related commands are as follows: