Show / Hide Table of Contents

Class FileSystem

Represents the filesystem for the Lambda function.

Inheritance
object
FileSystem
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_LATEST,
                Handler = "index.handler",
                Code = Code.FromAsset(Join(__dirname, "lambda-handler")),
                Vpc = vpc
            });

Synopsis

Constructors

FileSystem(IFileSystemConfig)

Represents the filesystem for the Lambda function.

Properties

Config

the FileSystem configurations for the Lambda function.

Methods

FromEfsAccessPoint(IAccessPoint, string)

mount the filesystem from Amazon EFS.

FromS3FilesAccessPoint(IAccessPointRef, string, IS3FilesOptions?)

Mount the filesystem from Amazon S3 Files.

Constructors

FileSystem(IFileSystemConfig)

Represents the filesystem for the Lambda function.

public FileSystem(IFileSystemConfig config)
Parameters
config IFileSystemConfig

the FileSystem configurations for the Lambda function.

Remarks

ExampleMetadata: infused

Properties

Config

the FileSystem configurations for the Lambda function.

public virtual IFileSystemConfig Config { get; }
Property Value

IFileSystemConfig

Remarks

ExampleMetadata: infused

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 string

the target path in the lambda runtime environment.

Returns

FileSystem

Remarks

ExampleMetadata: infused

FromS3FilesAccessPoint(IAccessPointRef, string, IS3FilesOptions?)

Mount the filesystem from Amazon S3 Files.

public static FileSystem FromS3FilesAccessPoint(IAccessPointRef ap, string mountPath, IS3FilesOptions? options = null)
Parameters
ap IAccessPointRef

the S3 Files access point.

mountPath string

the target path in the lambda runtime environment.

options IS3FilesOptions

optional S3 Files mount options such as DirectS3Read mode.

Returns

FileSystem

Remarks

ExampleMetadata: infused

Back to top Generated by DocFX