본문 바로가기
클라우드 AWS

AWS EFS(Elastic File System) 설치 및 마운트

by kula 2022. 3. 28.

[파일시스템 생성]

파일 시스템 이름 작성 및 VPC 선택

가용성 및 내구성 선택

파일 시스템 생성

ec2로 연결 해보자

연결 선택

kula-web#1, ec2로 접속

web#1에서 연결 하여 파일을 생성하고, web#2에서 연결하여 파일이 있는지 확인해보자

EFS 탑재 헬퍼 사용: sudo mkdir data sudo mount -t efs -o tls fs-0253ac4bf76be3fc9:/ data ※탑재헬퍼를 사용하려면, yum install -y amazon-efs-utils 설치

위 방법으로 안되는 경우

※dns를 통한 탑재 마운트시, 아래 오류가 뜨면서 마운트가 되지 않는 경우 VPC에서 dns 호스트 이름 비활성화임.

Failed to resolve "fs-0253ac4bf76be3fc9.efs.ap-northeast-1.amazonaws.com" - check that your file system ID is correct, and ensure that the VPC has an EFS mount target for this file system ID.

See https://docs.aws.amazon.com/console/efs/mount-dns-name for more detail.

Attempting to lookup mount target ip address using botocore. Failed to import necessary dependency botocore, please install botocore first.

mount.nfs4: Failed to resolve server fs-0253ac4bf76be3fc9.efs.ap-northeast-1.amazonaws.com: Name or service not known

mount.nfs4: Operation already in progress

Failed to resolve "fs-0253ac4bf76be3fc9.efs.ap-northeast-1.amazonaws.com". The file system mount target ip address cannot be found, please pass mount target ip address via mount options.

Unable to locate credentials when performing operation DescribeMountTargets, please confirm your aws credentials are properly configured.

[VPC] > [작업] > [DNS 호스트 이름 편집] > 활성화 체크

다시 DNS를 통한 탑재, EFS 탑재헬퍼를 사용하면 잘 마운트 됨.

※마운트 명령어 치기전에 시간이 생각외로(5분이상?) 오래걸리니 참고

cd /
sudo mount -t efs -o tls fs-0ac0b344a275190d4:/ data
잘 마운트 되었는지 조회
df -h

잘 마운트 되었다.

web#2 /data에서 파일생성, web#1에서 efs 연결후 생성한 파일이 잘보이면 성공

web#2서버 파일 생성

web#1서버에서 확인

확인완료

서버 재부팅시에도 자동마운트하는 방법

vi /etc/fstab
fs-0ac0b344a275190d4.efs.ap-northeast-1.amazonaws.com:/ /data nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev 0 0

설정 후 재부팅 하면 자동으로 마운트 된다.

중지 후 재시작 하여도 마운트 유지된다.

 

'클라우드 AWS' 카테고리의 다른 글

3. AWS apache(http) 설치  (0) 2022.03.28
AWS S3 bucket 설치(WAS to S3)  (0) 2022.03.28
6. AWS ROUTE 53 설정(도메인 연결)  (0) 2022.03.28
AWS EC2 시간 설정  (0) 2022.03.25
AWS EC2 SSH 접속하는 방법  (0) 2022.03.25

댓글