sync

Prev Next

Classic/VPC 환경에서 이용 가능합니다 .

Ncloud Storage에 생성된 버킷 간 또는 로컬 디렉토리와 폴더 및 객체를 동기화합니다.

명령어

명령어 구문은 다음과 같습니다.

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

파라미터

파라미터에 대한 설명은 다음과 같습니다.

파라미터 타입 필수 여부 설명 제약 사항
--endpoint-url <value> string Y 명령 호출의 기본 URL 지정 kr 리전만 가능, 호출 도메인 정보는 Ncloud Storage 개요 참고
--dryrun boolean N 동작 수행 결과만 확인하고 실제로는 미적용 -
--quiet boolean N 응답 결과 미노출 -
--include <value> string N 지정된 객체만 명령에 포함하도록 규칙 설정, 지정된 순서대로 적용 -
--exclude <value> string N 지정된 객체는 명령에 제외하도록 규칙 설정, 지정된 순서대로 적용 -
--follow-symlinks 또는 --no-follow-symlinks boolean N 업로드하는 파일의 심볼릭 링크의 콘텐츠 업로드 여부 설정 로컬 파일 시스템에서 객체를 업로드하는 경우에만 해당
--no-guess-mime-type boolean N 업로드된 객체의 콘텐츠 유형 자동 지정 비활성화 -
--storage-class <value> string N 객체를 저장할 스토리지 클래스 지정 선택 가능한 옵션
- STANDARD
- DEEP_ARCHIVE
* Default는 Standard 클래스에 저장
--content-type <value> string N 명시적인 콘텐츠 유형 정의 -
--cache-control <value> string N 캐싱 동작 설정 -
--content-disposition <value> string N 객체에 대한 표현 정보 지정 -
--content-encoding <value> string N 콘텐츠 인코딩 설정 -
--content-language <value> string N 콘텐츠 언어 설정 -
--only-show-errors boolean N 에러만 표시, 다른 응답값은 미노출 -
--no-progress boolean N 파일 전송 진행율 미표시 --quite 또는 --only-show-erros가 지정된 경우, 미적용
--page-size <value> integer N 각 응답별 리스팅 개수 지정 최대 1,000개 지원
--ignore-glacier-warnings boolean N Deep Archive에 있는 객체에 대한 변경 작업(복사, 다운로드, 이동 등) 미지원 관련 경고 미노출 -
--metadata <value> string N 객체와 함께 저장할 메타데이터 설정 -
--copy-props <value> string N 원본 객체에서 복사할 속성값 설정 Ncloud Storage에서 Ncloud Storage로 복사하는 경우에만 적용
--metadata-directive <value> string N CopyObject 작업에 대한 x-amz-metadata-directive 헤더 설정 이 옵션이 설정된 경우, --copy-props 비활성화됨
--size-only boolean N key의 사이즈만을 기준으로 동기화 여부 결정하도록 적용 -
--exact-timestamps boolean N Ncloud Storage에서 로컬로 동기화할 때, Ncloud Storage와 로컬에 있는 동일 사이즈 객체의 타임스탬프가 정확히 일치하는 경우 제외 -
--delete boolean N 원본 버킷 또는 로컬 디렉토리와 비교하여 원본에는 없지만 동기화 목적지 버킷 또는 디렉토리에만 있는 객체는 동기화 중 삭제하도록 설정 -
--debug boolean N 디버그 로깅 사용 -
--no-verify-ssl boolean N SSL 인증서를 검증하는 기본 동작 재정의 -
--no-paginate boolean N 자동 pagination 비활성화, 결과에 대해 첫 번째 페이지 한 번만 호출됨 -
--output <value> string N 응답값의 포맷 지정 선택한 가능한 옵션
- json
- text
- table
- yaml
- yaml-stream
--query <value> string N 응답 데이터를 필터링하는 데 사용할 JMESPath 쿼리 -
--profile <value> string N 자격 증명 파일에서 특정 profile 사용 -
--region <value> string N 리전 지정 kr만 지원
--color <value> string N output color 설정 선택한 가능한 옵션
- on
- off
- auto
--no-sign-request boolean N 자격 증명 로드 비활성화 -
--ca-bundle <value> string N SSL 인증서를 확인할 때 사용할 CA 인증서 지정 -
--cli-read-timeout <value> int N 최대 읽기 시간, 0으로 입력시 타임아웃이 아닌 차단 상태로 변경됨 default는 60초로 설정
--cli-connect-timeout <value> int N 최대 연결 시간, 0으로 입력시 타임아웃이 아닌 차단 상태로 변경됨 default는 60초로 설정
--no-cli-pager boolean N 응답값의 cli pager 비활성화 -
--cli-auto-prompt boolean N CLI 입력 파라미터 자동 프롬프트 설정 -
--no-cli-auto-prompt boolean N CLI 입력 파라미터 자동 프롬프트 비활성화 -

예시

sync 명령어의 호출과 응답 예시를 설명합니다.

지정된 Ncloud Storage의 버킷을 다른 버킷으로 동기화

호출 예시

동기화하고자 하는 소스 버킷과 대상 버킷을 지정하여 명령어를 호출하면 소스 버킷의 객체를 복사하여 동기화합니다. 이 때 Standard Class에 저장되어 있거나 복원 완료된 Deep Archive Class에 저장된 객체만 복사됩니다. 호출 예시는 다음과 같습니다.

aws s3 sync s3://bucket-aa s3://bucket-sync --endpoint-url=http://kr.ncloudstorage.com

응답 예시

응답 예시는 다음과 같습니다.

copy: s3://bucket-aa/log-2412/241202120123.txt to s3://bucket-sync/log-2412/241202120123.txt
copy: s3://bucket-aa/image4.png to s3://bucket-sync/image4.png    
copy: s3://bucket-aa/image3.png to s3://bucket-sync/image3.png    
warning: Skipping file s3://bucket-aa/log-2412/image.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.
warning: Skipping file s3://bucket-aa/log-2412/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.

로컬 객체를 지정된 Ncloud Storage 버킷에 동기화 하고 일치하지 않는 모든 객체 삭제

호출 예시

--delete 옵션을 활용하여 명령어를 호출하면 동기화 목적지 버킷 또는 디렉토리에서 원본에 없는 객체는 삭제할 수 있습니다.

aws s3 sync ./sync/ s3://bucket-sync --endpoint-url=http://kr.ncloudstorage.com --delete 

응답 예시

응답 예시는 다음과 같습니다.

delete: s3://bucket-sync/image.png
delete: s3://bucket-sync/image2.png                            
upload: sync/image/4.png to s3://bucket-sync/image/4.png        
upload: sync/image/1.png to s3://bucket-sync/image/1.png        
delete: s3://bucket-sync/log-2412/241201120224.txt              
delete: s3://bucket-sync/log-2412/241203120012.txt                                
upload: sync/document/1.pdf to s3://bucket-sync/document/1.pdf  
delete: s3://bucket-sync/ncs_5.png                            
delete: s3://bucket-sync/ncloudstorage5.pptx                  

Ncloud Storage 버킷에 저장된 객체 중 특정 prefix 하위의 객체를 제외한 모든 객체를 로컬 디렉토리에 동기화

호출 예시

--recursive 옵션을 사용하면 prefix 하위의 모든 객체를 포함하여 조회가 가능하며 --summarize 옵션을 사용하면 해당 버킷 또는 특정 prefix 하위에 저장된 오브젝트의 총 개수와 크기를 확인할 수 있습니다. 호출 예시는 다음과 같습니다.

 aws s3 sync s3://bucket-sync ./ncs/ --endpoint-url=http://kr.ncloudstorage.com --exclude "*document/*" 

응답 예시

응답 예시는 다음과 같습니다.

download: s3://bucket-sync/test.txt to ncs/test.txt              
download: s3://bucket-sync/test2.txt to ncs/test2.txt            
download: s3://bucket-sync/test3.txt to ncs/test3.txt            
download: s3://bucket-sync/image/4.png to ncs/image/4.png         
download: s3://bucket-sync/image/1.png to ncs/image/1.png