Classic/VPC 환경에서 이용 가능합니다.
Ncloud Storage 버킷 간 또는 버킷과 로컬 디렉터리 간에 폴더와 객체를 동기화합니다.
구문
sync 구문은 다음과 같습니다.
aws s3 sync \
<source> \
<destination> \
[--dryrun] \
[--quiet] \
[--include <include>] \
[--exclude <exclude>] \
[--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>] \
[--size-only] \
[--exact-timestamps] \
[--delete] \
--endpoint-url <endpoint-url>
옵션
sync 실행 시 지정할 수 있는 옵션을 설명합니다.
필수 옵션
sync의 필수 옵션입니다.
| 옵션 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
<source> |
String | Required | 원본 경로
|
<destination> |
String | Required | 대상 경로
|
선택 옵션
sync의 선택 옵션입니다. 지정하지 않은 옵션에는 기본값이 적용됩니다.
| 옵션 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
--dryrun |
Boolean | Optional | 명령을 실제로 실행하지 않고 수행 결과만 확인 |
--quiet |
Boolean | Optional | 응답 결과 미표시 |
--include |
String | Optional | 지정한 패턴과 일치하는 객체만 명령에 포함
|
--exclude |
String | 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 | 동기화 시 메타데이터 처리 방식
|
--size-only |
Boolean | Optional | 객체 크기만을 기준으로 동기화 여부 결정 |
--exact-timestamps |
Boolean | Optional | 크기가 같은 객체는 타임스탬프가 정확히 일치하는 경우에만 동기화 대상에서 제외
|
--delete |
Boolean | Optional | 원본에는 없고 대상 경로에만 있는 객체 삭제 |
공통 옵션
aws 명령에서 공통으로 사용하는 옵션에 대한 정보는 Ncloud Storage 옵션을 참조해 주십시오.
예시
요청이 성공하면 수행한 작업 유형과 함께 원본 경로, 대상 경로가 출력됩니다.
명령
버킷을 다른 버킷으로 동기화하면 Standard Class에 저장된 객체와 복원이 완료된 Deep Archive Class 객체만 복사되며, 복원되지 않은 객체는 건너뛰고 경고가 출력됩니다. 명령 예시는 다음과 같습니다.
aws s3 sync s3://my-test-bucket s3://my-sync-bucket \
--endpoint-url=https://kr.ncloudstorage.com
원본에 없는 객체를 삭제하면서 로컬 디렉터리를 버킷에 동기화하는 명령 예시는 다음과 같습니다.
aws s3 sync ./sync s3://my-sync-bucket \
--delete \
--endpoint-url=https://kr.ncloudstorage.com
특정 패턴을 제외하고 버킷의 객체를 로컬로 동기화하는 명령 예시는 다음과 같습니다.
aws s3 sync s3://my-sync-bucket ./ncs \
--exclude "*img/*" \
--endpoint-url=https://kr.ncloudstorage.com
출력
버킷을 다른 버킷으로 동기화하는 출력 예시는 다음과 같습니다.
copy: s3://my-test-bucket/sample.txt to s3://my-sync-bucket/sample.txt
copy: s3://my-test-bucket/img/copy.png to s3://my-sync-bucket/img/copy.png
copy: s3://my-test-bucket/large.bin to s3://my-sync-bucket/large.bin
warning: Skipping file s3://my-test-bucket/img/image2.png. Object is of storage class GLACIER. Unable to perform copy operations on GLACIER objects. You must restore the object to be able to perform the operation. See aws s3 copy help for additional parameter options to ignore or force these transfers.
CLI 경고 메시지에서는 Deep Archive Class가 GLACIER로 표시됩니다.
원본에 없는 객체를 삭제하면서 로컬 디렉터리를 버킷에 동기화하는 출력 예시는 다음과 같습니다.
upload: sync/report.txt to s3://my-sync-bucket/report.txt
upload: sync/img/image.png to s3://my-sync-bucket/img/image.png
delete: s3://my-sync-bucket/sample.txt
delete: s3://my-sync-bucket/large.bin
특정 패턴을 제외하고 버킷의 객체를 로컬로 동기화하는 출력 예시는 다음과 같습니다.
download: s3://my-sync-bucket/sample.txt to ncs/sample.txt
download: s3://my-sync-bucket/large.bin to ncs/large.bin