Skip to content

Instantly share code, notes, and snippets.

@ryanmaclean
Last active October 25, 2024 10:25
Show Gist options
  • Save ryanmaclean/c873c9a86f0bc3ee3a260882e73edecb to your computer and use it in GitHub Desktop.
Save ryanmaclean/c873c9a86f0bc3ee3a260882e73edecb to your computer and use it in GitHub Desktop.

Revisions

  1. ryanmaclean revised this gist Jul 4, 2018. 1 changed file with 12 additions and 7 deletions.
    19 changes: 12 additions & 7 deletions ubuntu_mount_efs.md
    Original file line number Diff line number Diff line change
    @@ -11,23 +11,28 @@ aws efs describe-file-systems --profile TEST --region us-east-2
    "FileSystems": [
    {
    "SizeInBytes": {
    "Timestamp": 71999.0,
    "Timestamp": 71990.0,
    "Value": 614
    },
    "Name": "GitLab-Shared-Storage-TEST",
    "Name": "Shared-Storage-TEST",
    "CreationToken": "console-ac435345",
    "CreationTime": 14723446.0,
    "FileSystemId": "fz-73a2",
    "NumberOfMountTargets": 3,
    "FileSystemId": "fz-83A2",
    "NumberOfMountTargets": 2,
    "LifeCycleState": "available",
    "OwnerId": "3423319"
    "OwnerId": "3423349"
    }
    ]
    }
    ```

    To get only the ID:
    `aws efs describe-file-systems --profile TEST --region us-east-1 | grep FileSystemId | cut -f 4- -d '"' | cut -f -1 -d '"'`
    `aws efs describe-file-systems \
    --profile TEST \
    --region us-east-1 | \
    grep FileSystemId | \
    cut -f 4- -d '"' | \
    cut -f -1 -d '"'`

    Or with `jq` installed:

    @@ -47,5 +52,5 @@ sudo mount -t nfs4 -o vers=4.1 $(curl -s http://169.254.169.254/latest/meta-data

    For example:
    ```
    sudo mount -t nfs4 -o vers=4.1 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-ebeb2f43342.efs.$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}').amazonaws.com:/ ~/efs-mount-point2
    sudo mount -t nfs4 -o vers=4.1 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-ebeb2f234242.efs.$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}').amazonaws.com:/ ~/efs-mount-point2
    ```
  2. ryanmaclean renamed this gist Oct 27, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. ryanmaclean created this gist Oct 27, 2016.
    51 changes: 51 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    # EFS Mounting on Ubuntu

    ## Get EFS ID
    ```
    aws configure set preview.efs true
    aws efs describe-file-systems --profile TEST --region us-east-2
    ```

    ```
    {
    "FileSystems": [
    {
    "SizeInBytes": {
    "Timestamp": 71999.0,
    "Value": 614
    },
    "Name": "GitLab-Shared-Storage-TEST",
    "CreationToken": "console-ac435345",
    "CreationTime": 14723446.0,
    "FileSystemId": "fz-73a2",
    "NumberOfMountTargets": 3,
    "LifeCycleState": "available",
    "OwnerId": "3423319"
    }
    ]
    }
    ```

    To get only the ID:
    `aws efs describe-file-systems --profile TEST --region us-east-1 | grep FileSystemId | cut -f 4- -d '"' | cut -f -1 -d '"'`

    Or with `jq` installed:

    ```
    aws efs describe-file-systems --profile TEST --region us-east-1 | jq -r ".FileSystems[] | .FileSystemId"
    ```


    ## Install NFS Client
    `sudo apt-get install nfs-common`

    ## Mount the EFS Storage
    ```
    mkdir efs-mount-point
    sudo mount -t nfs4 -o vers=4.1 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).file-system-id.efs.$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}').amazonaws.com:/ ~/efs-mount-point
    ```

    For example:
    ```
    sudo mount -t nfs4 -o vers=4.1 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-ebeb2f43342.efs.$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}').amazonaws.com:/ ~/efs-mount-point2
    ```