Class FileSystem
Represents the filesystem for the Lambda function.
Inheritance
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class FileSystem : DeputyBase
Syntax (vb)
Public Class FileSystem
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.EFS;
// create a new VPC
var vpc = new Vpc(this, "VPC");
// create a new Amazon EFS filesystem
var fileSystem = new FileSystem(this, "Efs", new FileSystemProps { Vpc = vpc });
// create a new access point from the filesystem
var accessPoint = fileSystem.AddAccessPoint("AccessPoint", new AccessPointOptions {
// 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
CreateAcl = new Acl {
OwnerUid = "1001",
OwnerGid = "1001",
Permissions = "750"
},
// enforce the POSIX identity so lambda function will access with this identity
PosixUser = new PosixUser {
Uid = "1001",
Gid = "1001"
}
});
var fn = new Function(this, "MyLambda", new FunctionProps {
// mount the access point to /mnt/msg in the lambda runtime environment
Filesystem = FileSystem.FromEfsAccessPoint(accessPoint, "/mnt/msg"),
Runtime = Runtime.NODEJS_18_X,
Handler = "index.handler",
Code = Code.FromAsset(Join(__dirname, "lambda-handler")),
Vpc = vpc
});
Synopsis
Constructors
FileSystem(IFileSystemConfig) | |
FileSystem(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
FileSystem(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Config | the FileSystem configurations for the Lambda function. |
Methods
FromEfsAccessPoint(IAccessPoint, String) | mount the filesystem from Amazon EFS. |
Constructors
FileSystem(IFileSystemConfig)
public FileSystem(IFileSystemConfig config)
Parameters
- config IFileSystemConfig
the FileSystem configurations for the Lambda function.
FileSystem(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected FileSystem(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
FileSystem(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected FileSystem(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Config
the FileSystem configurations for the Lambda function.
public virtual IFileSystemConfig Config { get; }
Property Value
Methods
FromEfsAccessPoint(IAccessPoint, String)
mount the filesystem from Amazon EFS.
public static FileSystem FromEfsAccessPoint(IAccessPoint ap, string mountPath)
Parameters
- ap IAccessPoint
the Amazon EFS access point.
- mountPath System.String
the target path in the lambda runtime environment.
Returns