# FileSystem

Represents the filesystem for the Lambda function.

- Source: [`aws-lambda/lib/filesystem.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-lambda/lib/filesystem.ts#L164)
- Type last changed: v2.270.0 · 17 Sep 2026

## Example

```ts
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as efs from 'aws-cdk-lib/aws-efs';

// create a new VPC
const vpc = new ec2.Vpc(this, 'VPC');

// create a new Amazon EFS filesystem
const fileSystem = new efs.FileSystem(this, 'Efs', { vpc });

// create a new access point from the filesystem
const accessPoint = fileSystem.addAccessPoint('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
  createAcl: {
    ownerUid: '1001',
    ownerGid: '1001',
    permissions: '750',
  },
  // enforce the POSIX identity so lambda function will access with this identity
  posixUser: {
    uid: '1001',
    gid: '1001',
  },
});

const fn = new lambda.Function(this, 'MyLambda', {
  // mount the access point to /mnt/msg in the lambda runtime environment
  filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'),
  runtime: lambda.Runtime.NODEJS_LATEST,
  handler: 'index.handler',
  code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
  vpc,
});
```

## Properties

- `config`: [FileSystemConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FileSystemConfig.html) — the FileSystem configurations for the Lambda function.

## Methods

- `fromEfsAccessPoint(ap: IAccessPoint, mountPath: string): FileSystem // chainable` (static) — mount the filesystem from Amazon EFS.

  **Parameters**

  - `ap` — the Amazon EFS access point.
  - `mountPath` — the target path in the lambda runtime environment.

- `fromS3FilesAccessPoint(ap: IAccessPointRef, mountPath: string, options?: S3FilesOptions): FileSystem // chainable` (static) — Mount the filesystem from Amazon S3 Files.

  **Parameters**

  - `ap` — the S3 Files access point.
  - `mountPath` — the target path in the lambda runtime environment.
  - `options` — optional S3 Files mount options such as DirectS3Read mode.
