Mounting an EFS

Hi, I’m working with a lambda function that needs to have mounted an EFS somewhere in /mnt/.
I’m taking a look at the AWS reference (links at the bottom) and I’m failing to find how to specify the EFS Access Point ARN and the Local Mount Path.
I was expecting something like:

provider:
  name: aws
  filesystem:
    - arn: "arn:aws:elasticfilesystem:region:id:access-point/apId"
      localMountPath: /mnt/efs1

Is this supported?

Links:

1 Like

Hmmm, actually I’m failing to find this feature in the source code.
I’m going to implement this locally, could you recommend me a developers guide to follow?

1 Like

Need this feature too. Seems only SAM has it now and not the Serverless framework.

Edit: They’ve opened up an issue by the way for this:

Just wanted to mention that I found a workaround. I’m using plugin serverless-default-aws-resource-properties and setting the EFS configuration as a default for all Lambda functions. Because of that, obviously only lambdas that need this configuration should be in this stack.

custom:
  defaultAwsProperties:
    - Type: AWS::Lambda::Function
      Properties:
        FileSystemConfigs:
          - Arn: { 'Fn::GetAtt': [ efsAP, Arn ] }
            LocalMountPath: ${self:custom.fsPath}

And it correctly generates the code, but again, with the caveat that all lambdas in this stack will have this configuration.

Hi, I just tried that and I’m getting this error: Cannot read property ‘Resources’ of undefined
Any ideas?

same error for me as well. Cannot read property ‘Resources’ of undefined

Can you share the complete serverless.yml please?
Thank you!

I had the same error. Declaring each lambda in the resources section of the yaml file solved it.

plugins:
  - serverless-default-aws-resource-properties

defaultAwsProperties:
    - Type: AWS::Lambda::Function
      Properties:
        FileSystemConfigs:
          - Arn: 'arn:aws:elasticfilesystem:${self:provider.region}:#{AWS::AccountId}:access-point/${self:custom.efsAccessPoint}'
            LocalMountPath: '${self:custom.LocalMountPath}'
functions:
  Lambda1:
  Lambda2:
  Lambda3:

resources:
  Resources:
    Lambda1:
      Type: AWS::Lambda::Function
    Lambda2:
      Type: AWS::Lambda::Function
    Lambda3:
      Type: AWS::Lambda::Function

Alternatively, this blog post uses the extensions ability of the serverless framework to add the efs to a single function if that’s more suitable to your use case.