7

I am trying to use aws lambda and efs together so I can perform operations that exceed the default lambda storage limit of 500mb. I am confused what the difference is between Local mount path and Access point.

Is the local mount path a term used to describe where the file system is mounted in the existing file system and the access point (which also has it's own path) the location that an application would reference in code? Or does it not actually matter which path is referenced?

For example

AccessPointResource:
    Type: 'AWS::EFS::AccessPoint'
    Properties:
      FileSystemId: !Ref FileSystemResource
      PosixUser:
        Uid: "1000"
        Gid: "1000"
      RootDirectory:
        CreationInfo:
          OwnerGid: "1000"
          OwnerUid: "1000"
          Permissions: "0777"
        Path: "/myefs"

is how I create the access point and the mount path I have specified directly on the lambda for testing.

enter image description here

I guess the main confusion I am having is why are there 2 paths, what is the difference between them and which one should I use in my lambda?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Ryan-Neal Mes
  • 6,003
  • 7
  • 52
  • 77

2 Answers2

9

Your EFS can have many directories on it:

/myefs
/myefs2
/myefs3
/myefs4
/important
/images

Your AccessPointResource will only enable access to /myefs. This folder will be basically the root to anyone who uses the access point. No other folder will be exposed through this access point.

/mnt/efs is the mount folder in the lambda container. So your function will be able to access /myefs mounted in its local directory tree under the name of /mnt/efs.

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • So does that mean if I want to save a file I need to save it to `/mnt/efs/myefs` ? Or will I be able to just save to `/myefs`? – Ryan-Neal Mes Sep 02 '20 at 21:42
  • 1
    @Ryan-NealMes It should be just `/mnt/efs` from what I remember. So files created in `/mnt/efs` folder should be actually placed in `/myefs` on the EFS filesystem. – Marcin Sep 02 '20 at 21:48
  • 3
    I am following now - the AccessPoint relates to efs and the mount folder relates to the lambda. These together link the two. When saving files from the lambda they need to be saved to the mounted folder and this propagates to efs via the AccessPoint. The AccessPoint path is not available in the lambda as a directory to save to. This may be obvious, but it wasn't to me :/ – Ryan-Neal Mes Sep 03 '20 at 00:53
1

Mount path has to be the same as the access point root directory - in your case you should change local mount path from "/mnt/efs" to "/mnt/myefs" (or if you want the mount path to be "/mnt/efs" you should change acces point root directory to "efs")

You can also see this answer

aurelia
  • 493
  • 8
  • 12