Classic/VPC 환경에서 이용 가능합니다.
버킷에 객체를 업로드하거나 이미 업로드한 객체를 로컬에 다운로드 또는 다른 위치에 복사합니다.
구문
cp 구문은 다음과 같습니다.
aws s3 cp \
<source> \
<destination> \
[--dryrun] \
[--quiet] \
[--include <include>] \
[--exclude <exclude>] \
[--recursive] \
[--follow-symlinks | --no-follow-symlinks] \
[--no-guess-mime-type] \
[--storage-class <storage-class>] \
[--content-type <content-type>] \
[--cache-control <cache-control>] \
[--content-disposition <content-disposition>] \
[--content-encoding <content-encoding>] \
[--content-language <content-language>] \
[--only-show-errors] \
[--no-progress] \
[--page-size <page-size>] \
[--ignore-glacier-warnings] \
[--metadata <metadata>] \
[--copy-props <copy-props>] \
[--metadata-directive <metadata-directive>] \
--endpoint-url <endpoint-url>
옵션
cp 실행 시 지정할 수 있는 옵션을 설명합니다.
필수 옵션
cp의 필수 옵션입니다.
| 옵션 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
<source> |
String | Required | 원본 경로
|
<destination> |
String | Required | 대상 경로
|
선택 옵션
cp의 선택 옵션입니다. 지정하지 않은 옵션에는 기본값이 적용됩니다.
| 옵션 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
--dryrun |
Boolean | Optional | 명령을 실제로 실행하지 않고 수행 결과만 확인 |
--quiet |
Boolean | Optional | 응답 결과 미표시 |
--include |
String | Optional | 지정한 패턴과 일치하는 객체만 명령에 포함
|
--exclude |
String | Optional | 지정한 패턴과 일치하는 객체를 명령에서 제외
|
--recursive |
Boolean | Optional | 지정한 경로의 하위 항목까지 복사 |
--follow-symlinks, --no-follow-symlinks |
Boolean | Optional | 심볼릭 링크가 가리키는 파일의 콘텐츠 업로드 여부
|
--no-guess-mime-type |
Boolean | Optional | 업로드할 객체의 콘텐츠 유형 자동 추측 비활성화 |
--storage-class |
String | Optional | 객체를 저장할 스토리지 클래스 지정
|
--content-type |
String | Optional | 명시적인 콘텐츠 유형 정의 |
--cache-control |
String | Optional | 캐싱 동작 설정 |
--content-disposition |
String | Optional | 객체의 표시 방식 지정 |
--content-encoding |
String | Optional | 콘텐츠 인코딩 설정 |
--content-language |
String | Optional | 콘텐츠 언어 설정 |
--only-show-errors |
Boolean | Optional | 에러만 표시하고 다른 응답값은 미표시 |
--no-progress |
Boolean | Optional | 파일 전송 진행률 미표시
|
--page-size |
Integer | Optional | 페이지당 항목 수
|
--ignore-glacier-warnings |
Boolean | Optional | Deep Archive에 있는 객체에 대한 변경 작업(복사, 다운로드, 이동 등) 미지원 관련 경고 미표시 |
--metadata |
String | Optional | 객체와 함께 저장할 메타데이터 설정 |
--copy-props |
String | Optional | 원본 객체에서 복사할 속성값 설정
|
--metadata-directive |
String | Optional | 복사 시 메타데이터 처리 방식
|
공통 옵션
aws 명령에서 공통으로 사용하는 옵션에 대한 정보는 Ncloud Storage 옵션을 참조해 주십시오.
예시
요청이 성공하면 수행한 작업 유형과 함께 원본 경로, 대상 경로가 출력됩니다.
명령
로컬 파일을 버킷에 업로드하는 명령 예시는 다음과 같습니다.
aws s3 cp sample.txt s3://my-test-bucket/docs/sample.txt \
--endpoint-url=https://kr.ncloudstorage.com
버킷 내 다른 경로로 객체를 복사하는 명령 예시는 다음과 같습니다.
aws s3 cp s3://my-test-bucket/img/image.png s3://my-test-bucket/img/copy.png \
--endpoint-url=https://kr.ncloudstorage.com
객체의 스토리지 클래스를 변경하는 명령 예시는 다음과 같습니다.
aws s3 cp s3://my-test-bucket/img/copy.png s3://my-test-bucket/img/copy.png \
--storage-class DEEP_ARCHIVE \
--endpoint-url=https://kr.ncloudstorage.com
버킷의 객체를 로컬로 다운로드하는 명령 예시는 다음과 같습니다.
aws s3 cp s3://my-test-bucket/docs/sample.txt ./ \
--endpoint-url=https://kr.ncloudstorage.com
출력
로컬 파일을 버킷에 업로드하는 출력 예시는 다음과 같습니다.
upload: ./sample.txt to s3://my-test-bucket/docs/sample.txt
버킷 내 다른 경로로 객체를 복사하는 출력 예시는 다음과 같습니다.
copy: s3://my-test-bucket/img/image.png to s3://my-test-bucket/img/copy.png
객체의 스토리지 클래스를 변경하는 출력 예시는 다음과 같습니다.
copy: s3://my-test-bucket/img/copy.png to s3://my-test-bucket/img/copy.png
버킷의 객체를 로컬로 다운로드하는 출력 예시는 다음과 같습니다.
download: s3://my-test-bucket/docs/sample.txt to ./sample.txt