cp

Prev Next

Available in Classic and VPC

Upload an object to a bucket, or download an object that has already been uploaded to local or copy it to another location.

Commands

The command statement is as follows:

aws s3 cp <source> <destination> --endpoint-url <value> [--options] 

Parameter

The following describes the parameters.

Parameter Type Required Description Restrictions
--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.
--dryrun boolean N Only check the results of the action, but do not actually apply them. -
--quiet boolean N Response results not displayed -
--include <value> string N Set the rule to include only specified objects in commands and apply them in the specified order. -
--exclude <value> string N Set the rule to exclude specified objects from commands and apply them in the specified order. -
--follow-symlinks or --no-follow-symlinks boolean N Set whether to upload the content of symbolic links in uploaded file. Only applicable when uploading objects from the local file system
--no-guess-mime-type boolean N Disable automatic content type determination for uploaded object. -
--storage-class <value> string N Specify the storage class for storing the object. Available options
- STANDARD
- DEEP_ARCHIVE
* It stores it as Standard class by default.
--content-type <value> string N Define explicit content type. -
--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. -
--only-show-errors boolean N Only errors are displayed; other response values are not displayed. -
--no-progress boolean N File transfer progress not displayed Not applicable if --quite or --only-show-erros is specified
--page-size <value> integer N Specify the number of listings for each response. Up to 1000 supported
--ignore-glacier-warnings boolean N Warning not displayed regarding unsupported changes (copying, downloading, moving, etc.) to object in Deep Archive -
--metadata <value> string N Set up metadata to store with the object. -
--copy-props <value> string N Set the property values to be copied from the original object. Only applicable when copying from Ncloud Storage to Ncloud Storage
--metadata-directive <value> string N Set the x-amz-metadata-directive header for the CopyObject operation. If this option is enabled, --copy-props is disabled.
--recursive boolean N Apply command scope to subdirectories. -
--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 call 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. -

Examples

This section describes an example of calling and responding to the cp command.

Upload local object to Ncloud Storage

Call examples

You can upload an object by specifying the path of the local file to be uploaded to Ncloud Storage and the destination bucket. The following is a call example.

aws s3 cp test.txt s3://bucket-aa/ --endpoint-url=http://kr.ncloudstorage.com

Response example

The response example is as follows:

upload: ./test.txt to s3://bucket-aa/text.txt                   

Copy object stored in Ncloud Storage to another location within Ncloud Storage

Call examples

You can copy an object by specifying the path of the original object to be copied and the destination location, 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 s3 cp s3://bucket-aa/image.png s3://bucket-a/img/ --endpoint-url=http://kr.ncloudstorage.com

Response example

The response example is as follows:

copy: s3://bucket-aa/image.png to s3://bucket-a/img/image.png 

Change object stored in Standard Class to Deep Archive Class

Call examples

You can change the storage class of an object by calling the command with the storage class option. You can use the cp command to change object properties such as metadata and storage class. The following is a call example.

aws s3 cp s3://bucket-aa/1234.png s3://bucket-aa/ --endpoint-url=http://kr.ncloudstorage.com --storage-class=DEEP_ARCHIVE

Response example

The response example is as follows:

copy: s3://bucket-aa/1234.png to s3://bucket-aa/1234.png 

Download object stored in Ncloud Storage to local

Call examples

You can copy an object by specifying the path of the source object to be downloaded and the local path to be downloaded, and then calling the command. Only objects stored in the Standard Class or restored from the Deep Archive Class can be downloaded. The following is a call example.

aws s3 cp s3://bucket-aa/image.png ./ --endpoint-url=http://kr.ncloudstorage.com

Response example

The response example is as follows:

download: s3://bucket-aa/image.png to ./image.png