Documentation Index

Fetch the complete documentation index at: https://cli.ncloud-docs.com/llms.txt

Use this file to discover all available pages before exploring further.

put-object

Prev Next

Available in Classic and VPC

Save an object in Ncloud Storage.

Commands

The command statement is as follows:

aws s3api put-object --bucket <value> --key <value> [--options]
Note

You can upload objects up to 5 GB in size with a single put operation. Large files larger than 5 GB can be uploaded using multipart upload.

Parameter

The following describes the parameters.

Parameter Type Required Description Restrictions
--bucket <value> string Y Name of the bucket to save the object -
--endpoint-url <value> string Y Specify the default URL for command calls. It is only available for the KR Region. See Ncloud Storage overview for call domain information.
--key <value> string Y Name (key value) of the object to upload -
--body <value> string N Object data Path or file of the object to upload
--cache-control <value> string N Set caching behavior. -
--content-disposition <value> string N Specify representation information for the object. -
--content-encoding <value> string N Set content encoding. -
--content-language <value> string N Set content language. -
--content-length <value> long N Size of the body (byte) -
--content-md5 <value> string N Base64-encoded value of the 128-bit encryption hash value of the uploaded object -
--content-type <value> string N Define explicit content type. -
--metadata <value> string N Set up metadata to store with the object. -
--storage-class <value> string N Specify the storage class for storing the object. Available options
  • STANDARD
  • DEEP_ARCHIVE
  • * Default: Store in the Standard class.
--cli-input-json | --cli-input-yaml string N Enter arguments from the provided json or yaml string. You can't specify json and yaml together.
--generate-cli-skeleton <value> integer N Create a parameter template that can be used as input later without executing the API command. -
--debug boolean N Use debug logging. -
--no-verify-ssl boolean N Redefine the default behavior for validating SSL certificates. -
--no-paginate boolean N Disable automatic pagination, call only the first page for results. -
--output <value> string N Specify the format of response results. Available options
  • json
  • text
  • table
  • yaml
  • yaml-stream
--query <value> string N JMESPath query to use for filtering response data -
--profile <value> string N Use a specific profile in the credentials file. -
--region <value> string N Specify the Region. Only KR is supported.
--color <value> string N Set output color. Available options
  • on
  • off
  • auto
--no-sign-request boolean N Disable credential loading. -
--ca-bundle <value> string N Specify the CA certificate to use when verifying SSL certificates. -
--cli-read-timeout <value> int N Maximum read time; entering 0 changes it to a blocked status instead of a timeout. It is set to 60 seconds by default.
--cli-connect-timeout <value> int N Maximum connection time; entering 0 changes it to a blocked status instead of a timeout. It is set to 60 seconds by default.
--no-cli-pager boolean N Disable the CLI pager for response values. -
--cli-auto-prompt boolean N Enable automatic prompting for CLI input parameters. -
--no-cli-auto-prompt boolean N Disable automatic prompting for CLI input parameters. -
--server-side-encryption string N Server-side encryption type Available options
  • AES256
  • aws:kms
--sse-customer-algorithm string N User encryption algorithm (AES256) -
--sse-customer-key string N User-provided encryption key -
--sse-customer-key-md5 string N User-provided encryption key's MD5 value -
--object-lock-mode <value> string N Specify object retention mode. Available options
  • GOVERNANCE
  • COMPLIANCE
Specify with --object-lock-retain-until-date, available only in buckets where object lock is enabled.
--object-lock-retain-until-date <value> timestamp N Specify object retention expiration date. ISO 8601 format, specify with --object-lock-mode, available only in buckets where object lock is enabled.
--object-lock-legal-hold-status <value> string N Specify legal hold status. Available options
  • ON
  • OFF
Available only in buckets where object lock is enabled.

Permissions

If a sub account user wants to use this command, they need the Change/PutObject action permission.

Specific error codes

The following error codes may occur when calling the put-object command.

Error code HTTP Status Description
EntityTooLarge 400 The object size exceeds the single PUT upload limit (5 GB).
InvalidStorageClass 400 You specified an unsupported storage class (--storage-class).
KeyTooLongError 400 The object name (--key) exceeds the maximum length.
BadDigest 400 The specified --content-md5 value does not match the actual object data.
InvalidArgument 400 The object lock-related parameter value is invalid. This occurs when only one of --object-lock-mode and --object-lock-retain-until-date was specified, the mode value is incorrect, the expiration date is not in ISO 8601 format or is not in the future, or --object-lock-legal-hold-status is not set to ON or OFF.
InvalidRequest 400 You specified an object lock parameter for a bucket where object lock is not enabled.

Examples

This section describes an example of calling and responding to the put-object command.

Upload object

Call examples

You can upload an object to Ncloud Storage by specifying the bucket to store the object and specifying the object to upload as --body and then calling the command. If you do not specify a storage class, the objects are stored in the Standard Class. The following is a call example.

aws s3api put-object --bucket bucket-a --endpoint-url=https://kr.ncloudstorage.com --key img/image.png --body image.png

Response example

The response example is as follows:

{
    "ETag": "\"12345678a25bc72de9fg3094h1f30ij6\""
}

Upload object to Deep Archive Class of bucket with version control enabled

Call examples

If you call a command by specifying the storage class in which to store the object, the object is stored in that class. The following is a call example.

aws s3api put-object --bucket bucket-a --endpoint-url=https://kr.ncloudstorage.com --key img/image2.png --body image2.png --storage-class DEEP_ARCHIVE

Response example

The response example is as follows:

{
    "ETag": "\"a2b370952633c9d9ef503abcd8b460bb\"",
    "VersionId": "4d784abc-0941-11f0-954d-d4f5ef94c2b0"
}

Related commands

Related commands are as follows: