-
-
- launch 1 instance with SG=
ubuntu1-sg
& AZ=us-east-1a
- add 1 inbound rule:
-
- NFS (port: 2049)
-
- IP=
Anywhere IPv4
(0.0.0.0/0)
- IP=
⚠️ ⚠️ WARNING!!!⚠️ ⚠️ : EFS: change SG fromdefault
toubuntu1-sg
- launch 1 instance with SG=
-
- SSH to ubuntu:
~$ sudo apt update -y # 1st sudo apt install git binutils -y git clone https://github.com/aws/efs-utils ./efs-utils/build-deb.sh sudo apt update -y # 2nd sudo apt install ./build/amazon-efs-utils*deb -y mkdir ~/efs-mount ubuntu@ubuntu:~$ sudo mount -t efs -o tls fs-0cf6164f211e8bdd7:/ efs-mount df -T | grep nfs4 -> 127.0.0.1:/ nfs4 9007199254739968 0 9007199254739968 0% ~/efs-mount ~$ sudo touch efs-mount/DTQUbuntu.txt sudo umount efs-mount df -T | grep nfs4 -> NOT see!!! ~$ ls efs-mount -> 0!!!
-
-
-
- launch 1 instance with SG=
linux1-sg
& AZ=us-east-1b
- add EFS with path
/efs-mount
(different from~/efs-mount
)
sau khi launch EC2 thi KO the edit them EFS lai duoc!!!
- will auto create 2 SG
instance-sg-1
&efs-sg-1
- SG's relation:
muon xoa
instance-sg-1
&efs-sg-1
thi phai delete Inbound Rule phu thuoc lan nhau!!! - launch 1 instance with SG=
-
~$ df -T | grep nfs4 -> 127.0.0.1:/ nfs4 9007199254739968 0 9007199254739968 0% /efs-mount ls /efs-mount -> `DTQUbuntu.txt`
-
-
-
~$ sudo touch /efs-mount/DTQLinux.txt
-
- will auto reflect to Ubuntu
~$ ls efs-mount -> `DTQUbuntu.txt` & `DTQLinux.txt`
-
-
~$ sudo mkdir /efs-mount-2 sudo mount -t efs -o tls fs-0cf6164f211e8bdd7:/ /efs-mount-2 # Linux default auto installed efs cli df -T | grep nfs4 -> 127.0.0.1:/ nfs4 9007199254739968 0 9007199254739968 0% /efs-mount 127.0.0.1:/ nfs4 9007199254739968 0 9007199254739968 0% /efs-mount-2
-
sudo apt-get install nfs-common # (for Ubuntu) sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-07ab2b2fd07cc4ead.efs.us-west-2.amazonaws.com:/ /mnt/efstest
-
config/filesystems.php
/* |-------------------------------------------------------------------------- | Filesystem Disks |-------------------------------------------------------------------------- */ 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'),... ], 'zip' => [ 'driver' => 'local', 'root' => env("AWS_MOUNTING_DIR", "/mnt/nfs"), ], ],