Serverless-application-model: EFS permission denied

Created on 22 Jun 2020  路  2Comments  路  Source: aws/serverless-application-model

I am unable to use EFS with lambda and I am getting permission denied following this example: https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/

func function() (events.APIGatewayProxyResponse, error) {
    if err := os.Mkdir(fmt.Sprintf("/mnt/efs/%v", "123"), os.ModePerm); err != nil {
        return events.APIGatewayProxyResponse{}, err
    }

    return events.APIGatewayProxyResponse{
        StatusCode:        200,
        Body:              "OK",
    }, nil
}

I get this error

mkdir /mnt/efs/123: permission denied: PathError null

Most helpful comment

@MatteoInfi Thanks for letting us know. I reached out to the owner of the blog for him to address this. Closing as we don't own that content.

All 2 comments

This example is very misleading: https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/

If you write like this:

```
AccessPointResource:
Type: 'AWS::EFS::AccessPoint'
Properties:
FileSystemId: !Ref FileSystemResource
PosixUser:
Uid: "1000"
Gid: "1000"
RootDirectory:
CreationInfo:
OwnerGid: "1000"
OwnerUid: "1000"
Permissions: "0777"
Path: "/lambda" // <========== this one

Than this have to be:

MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
...
FileSystemConfigs:
- Arn: arn:aws:elasticfilesystem:us-east-1:xxxxxx:accesspoint/
fsap-123abcdef12abcdef
LocalMountPath: /mnt/lambda // <============ here

and not :

    LocalMountPath: /mnt/efs // <====================== wrong

```

I will leave this open, the docs should be changed.

@MatteoInfi Thanks for letting us know. I reached out to the owner of the blog for him to address this. Closing as we don't own that content.

Was this page helpful?
0 / 5 - 0 ratings