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.
Syntax
The cp syntax is as follows:
aws s3 cp \
<source> \
<destination> \
[--dryrun] \
[--quiet] \
[--include <pattern>] \
[--exclude <pattern>] \
[--recursive] \
[--acl <acl>] \
[--follow-symlinks | --no-follow-symlinks] \
[--no-guess-mime-type] \
[--content-type <content-type>] \
[--only-show-errors] \
[--no-progress] \
[--page-size <page-size>] \
[--metadata <metadata>] \
[--metadata-directive <COPY|REPLACE>] \
--endpoint-url <endpoint-url>
Options
This section describes the options available when running cp.
Required options
The following options are required for cp.
| Options | Type | Required | Description |
|---|---|---|---|
<source> |
String | Required | Source path
|
<destination> |
String | Required | Destination path
|
Optional options
These are the optional options for cp. Options that are not specified will use their default values.
| Options | Type | Required | Description |
|---|---|---|---|
--dryrun |
Boolean | Optional | Checks the results of the command without actually executing it. |
--quiet |
Boolean | Optional | Does not display the response. |
--include |
String | Optional | Includes only objects matching the specified pattern in the command.
|
--exclude |
String | Optional | Excludes objects matching the specified pattern from the command.
|
--recursive |
Boolean | Optional | Copies items in subdirectories of the specified path. |
--acl |
String | Optional | List of access controls to apply to the object
|
--follow-symlinks, --no-follow-symlinks |
Boolean | Optional | Whether to upload the content of files pointed to by symbolic links
|
--no-guess-mime-type |
Boolean | Optional | Disables automatic guessing of the content type for objects to be uploaded. |
--content-type |
String | Optional | Define explicit content type. |
--only-show-errors |
Boolean | Optional | Displays only errors; other response values are not displayed. |
--no-progress |
Boolean | Optional | Does not display file transfer progress
|
--page-size |
Integer | Optional | Number of items per page
|
--metadata |
String | Optional | Set up metadata to store with the object. |
--metadata-directive |
String | Optional | Metadata handling options when copying
|
Common options
For information about the options common to all aws subcommands, see Object Storage options.
Examples
If the request is successful, the source and destination paths of the copied object are displayed.
Command
The following is an example command for uploading an object.
aws s3 cp sample.txt s3://my-test-bucket/sample.txt \
--endpoint-url=https://kr.object.ncloudstorage.com
The following is an example command for downloading an object.
aws s3 cp s3://my-test-bucket/sample.txt sample.txt \
--endpoint-url=https://kr.object.ncloudstorage.com
The following is a example command for uploading an entire directory.
aws s3 cp docs s3://my-test-bucket/docs \
--recursive \
--endpoint-url=https://kr.object.ncloudstorage.com
Output
The following is an example output for uploading an object.
Completed 46 Bytes/46 Bytes (185 Bytes/s) with 1 file(s) remaining
upload: ./sample.txt to s3://my-test-bucket/sample.txt
The following is an example output for downloading an object.
Completed 46 Bytes/46 Bytes (688 Bytes/s) with 1 file(s) remaining
download: s3://my-test-bucket/sample.txt to ./sample.txt
The following is an example output for uploading an entire directory.
Completed 41 Bytes/41 Bytes (468 Bytes/s) with 1 file(s) remaining
upload: docs/report.txt to s3://my-test-bucket/docs/report.txt