Giter Club home page Giter Club logo

aws-efs-connect-ec2-demo's Introduction

aws-efs-connect-ec2-demo 🐳

Stars Issues Forks Report an issue

detail

reference

  1. linuxhint
  2. aws

EFS

  • create DTQEFSDemo with:
    1. AZ=us-east-1a & us-east-1b
    1. SG=default (NOT in this screenshot) 4

EC2

  1. Ubuntu

    1. AWS

      • launch 1 instance with SG=ubuntu1-sg & AZ=us-east-1a
      • add 1 inbound rule:
        1. NFS (port: 2049)
        1. IP=Anywhere IPv4 (0.0.0.0/0)
      • ⚠️⚠️WARNING!!!⚠️⚠️: EFS: change SG from default to ubuntu1-sg
    2. SSH

      • 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!!!
  2. Linux

    1. AWS

      • launch 1 instance with SG=linux1-sg & AZ=us-east-1b
      • add EFS with path /efs-mount (different from ~/efs-mount) addefs

      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:
        1. EC2 linux has 2 SG: linux1-sg & instance-sg-1 3
        1. instance-sg-1 has NO inbound rule 1
        1. EFS DTQEFSDemo will auto added SG efs-sg-1 4
        1. efs-sg-1 has inbound rule with source=instance-sg-1 2

      muon xoa instance-sg-1 & efs-sg-1 thi phai delete Inbound Rule phu thuoc lan nhau!!!

    2. SSH

      ~$ df -T | grep nfs4
      ->
      127.0.0.1:/    nfs4     9007199254739968       0 9007199254739968    0% /efs-mount
      ls /efs-mount
      -> `DTQUbuntu.txt`
  3. change file/folder between Ubuntu & Linux

    1. Linux

      ~$ sudo touch /efs-mount/DTQLinux.txt
    2. Ubuntu

      • will auto reflect to Ubuntu
      ~$ ls efs-mount
      -> `DTQUbuntu.txt` & `DTQLinux.txt`
  4. mount in Linux

    ~$ 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

note

  1. connect EFS by NFS client besides EFS mount helper

    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
  2. config /mnt/nfs in filesystems example

    • 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"),
            ],
        ],

aws-efs-connect-ec2-demo's People

Contributors

tquangdo avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.