Open jessekrubin opened 3 years ago
@jessekrubin We need some more information so we can properly investigate your scenario.
Can you please edit the issue according to our issue template?
Thanks
@iliapolo Yes I can. sorry for the late reply. Was on vacation.
@jessekrubin are you still able to provide more information for this issue?
I am working on recreating the issue in a simple repo.
With the following cdk typescript app I see no way to add more than one efs mount. Any suggestions would be greatly appreciated.
import * as cdk from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as efs from '@aws-cdk/aws-efs';
import * as lambda from '@aws-cdk/aws-lambda';
import * as apigw from '@aws-cdk/aws-apigateway';
export class CdkLambdaEfsStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'Vpc', {
maxAzs: 2, // Default is all AZs in the region
});
// Create a file system in EFS to store information
const fs = new efs.FileSystem(this, 'FileSystem', {
vpc,
removalPolicy: cdk.RemovalPolicy.DESTROY
});
const accessPoint = fs.addAccessPoint('AccessPoint',{
createAcl: {
ownerGid: '1001',
ownerUid: '1001',
permissions: '750'
},
path:'/export/lambda',
posixUser: {
gid: '1001',
uid: '1001'
}
});
// defines an AWS Lambda resource
const hello = new lambda.Function(this, 'HelloHandler', {
runtime: lambda.Runtime.NODEJS_14_X, // execution environment
code: lambda.Code.fromAsset('lambda'), // code loaded from "lambda" directory
handler: 'hello.handler', // file is "hello", function is "handler"
vpc: vpc,
filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/data')
});
// defines an API Gateway REST API resource backed by our "hello" function.
new apigw.LambdaRestApi(this, 'Endpoint', {
handler: hello
});
}
}
@jessekrubin Thanks for the details.
To my understanding, you are looking for a way to attach multiple file systems to a lambda function, similarly to how you can do this in CloudFormation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-filesystemconfigs
This is currently not supported by the L2 Function
construct. I am repurposing this as a feature request and unassigning and marking this issue as p2
, which means that we are unable to work on this immediately.
We use +1s to help prioritize our work, and are happy to revaluate this issue based on community feedback. You can reach out to the cdk.dev community on Slack to solicit support for reprioritization.
In the meantime, you can use Escape Hatches to directly change the underlying CFN resource definition and add more file system configurations.
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Please implement this :)
From the cloudformation documentation, you can only specify a maximum of 1 FileSystemConfigs
. This means it's not possible for us to support this (without a custom resource).
We should try to repro to verify that the documentation is accurate.
Please implement multiple EFS mounts support.
Welp, add me to the list of folks who want this. Right now, it looks like I have to use EC2.
+1
+1
+1
Support configuring multiple file systems as available in CFN: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-filesystemconfigs
Currently we can only specify one file system:
https://github.com/aws/aws-cdk/blob/8ed088a4cc5388b85776c3486cb657462836d923/packages/%40aws-cdk/aws-lambda/lib/function.ts#L280
Originaly reported as:
(aws-efs): unable to mount more than one efs with lambda function
I can mount multiple efs volumes manually for a lambda but using the ts-cdk library I cannot mount more than a single efs volume.