FileSystem
- class aws_cdk.aws_lambda.FileSystem(*, arn, local_mount_path, connections=None, dependency=None, policies=None)
Bases:
object
Represents the filesystem for the Lambda function.
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_ec2 as ec2 import aws_cdk.aws_efs as efs # create a new VPC vpc = ec2.Vpc(self, "VPC") # create a new Amazon EFS filesystem file_system = efs.FileSystem(self, "Efs", vpc=vpc) # create a new access point from the filesystem access_point = file_system.add_access_point("AccessPoint", # set /export/lambda as the root of the access point path="/export/lambda", # as /export/lambda does not exist in a new efs filesystem, the efs will create the directory with the following createAcl create_acl=efs.Acl( owner_uid="1001", owner_gid="1001", permissions="750" ), # enforce the POSIX identity so lambda function will access with this identity posix_user=efs.PosixUser( uid="1001", gid="1001" ) ) fn = lambda_.Function(self, "MyLambda", # mount the access point to /mnt/msg in the lambda runtime environment filesystem=lambda_.FileSystem.from_efs_access_point(access_point, "/mnt/msg"), runtime=lambda_.Runtime.NODEJS_16_X, handler="index.handler", code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler")), vpc=vpc )
- Parameters:
arn (
str
) – ARN of the access point.local_mount_path (
str
) – mount path in the lambda runtime environment.connections (
Optional
[Connections
]) – connections object used to allow ingress traffic from lambda function. Default: - no connections required to add extra ingress rules for Lambda functiondependency (
Optional
[Sequence
[IDependable
]]) – array of IDependable that lambda function depends on. Default: - no dependencypolicies (
Optional
[Sequence
[PolicyStatement
]]) – additional IAM policies required for the lambda function. Default: - no additional policies required
Attributes
- config
the FileSystem configurations for the Lambda function.
Static Methods
- classmethod from_efs_access_point(ap, mount_path)
mount the filesystem from Amazon EFS.
- Parameters:
ap (
IAccessPoint
) – the Amazon EFS access point.mount_path (
str
) – the target path in the lambda runtime environment.
- Return type: