[Linux] mount-s3 설치 및 사용
mount-s3(mountpoint-s3)를 rpm으로 설치하고 aws configure로 자격 증명을 설정한 뒤 S3 버킷을 로컬 디렉터리에 마운트해 파일을 복사하는 과정을 정리합니다.
요약
mount-s3rpm을 설치하고mount-s3 <버킷> <디렉터리>를 실행하면 S3 버킷을 로컬 디렉터리에 fuse 파일시스템으로 마운트할 수 있습니다.- 마운트한 디렉터리에 복사한 파일은
aws s3 ls로 S3 버킷에서도 확인할 수 있습니다.
테스트 환경 mount-s3 1.0.0-1 (x86_64)
mount-s3 설치 및 사용
설치
[root@ip-172-31-5-165 ~]# yum -y install https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.rpm
...
Installed:
mount-s3.x86_64 0:1.0.0-1
Dependency Installed:
fuse.x86_64 0:2.9.2-11.amzn
aws configure
[root@ip-172-31-5-165 ~]# aws configure
AWS Access Key ID [None]: ******************
AWS Secret Access Key [None]: ******************
Default region name [None]: ap-northeast-2
Default output format [None]: json
[root@ip-172-31-5-165 ~]# aws s3 ls | tail -n1
2023-01-17 01:12:23 s3fsmounttest
mount
[root@ip-172-31-5-165 ~]# mount-s3 s3fsmounttest /root/test
bucket s3fsmounttest is mounted at /root/test
[root@ip-172-31-5-165 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 479016 0 479016 0% /dev
tmpfs 487796 0 487796 0% /dev/shm
tmpfs 487796 412 487384 1% /run
tmpfs 487796 0 487796 0% /sys/fs/cgroup
/dev/xvda1 8376300 1806468 6569832 22% /
tmpfs 97560 0 97560 0% /run/user/1000
[root@ip-172-31-5-165 ~]# mount | grep test
mountpoint-s3 on /root/test type fuse (rw,nosuid,nodev,noatime,user_id=0,group_id=0,default_permissions)
테스트
[root@ip-172-31-5-165 ~]# cp mount-s3.rpm /root/test/
[root@ip-172-31-5-165 ~]# ls -la /root/test
total 10189
drwxr-xr-x 2 root root 0 Aug 10 04:31 .
dr-xr-x--- 5 root root 147 Aug 10 04:31 ..
-rw-r--r-- 1 root root 10432224 Aug 10 04:31 mount-s3.rpm
-rw-r--r-- 1 root root 68 May 11 04:01 prj.txt
[root@ip-172-31-5-165 ~]# aws s3 ls s3testfsmount
2023-08-10 04:31:57 10432224 mount-s3.rpm
2023-05-11 04:01:01 68 prj.txt
참고 문서
자주 묻는 질문
mount-s3는 어떻게 설치하나요?
yum -y install https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.rpm으로 설치합니다. 설치 시 의존성으로 fuse 패키지가 함께 설치됩니다.
mount-s3로 S3 버킷을 마운트하려면 어떻게 하나요?
aws configure로 Access Key, Secret Access Key, 리전을 설정한 뒤 mount-s3 <버킷 이름> <마운트 경로>를 실행합니다. 정상 마운트되면 bucket ... is mounted at ... 메시지가 출력됩니다.
S3 버킷이 제대로 마운트되었는지 어떻게 확인하나요?
mount | grep <마운트 경로>로 mountpoint-s3 fuse 타입 마운트가 있는지 확인합니다. 마운트 경로에 파일을 복사한 뒤 aws s3 ls로 버킷에 올라갔는지도 확인할 수 있습니다.