Skip to content

AccessPoint

Source: src/AWS/EFS/AccessPoint.ts

An Amazon EFS access point — an application-specific entry point into a file system that enforces a POSIX identity and a root directory.

Access points are how Lambda (and other serverless compute) mounts EFS: pass accessPoint.accessPointArn to a Lambda Function’s fileSystemConfigs. The POSIX user and root directory are immutable — changing them replaces the access point.

import * as AWS from "alchemy/AWS";
const files = yield* AWS.EFS.FileSystem("Files");
const accessPoint = yield* AWS.EFS.AccessPoint("FilesAccess", {
fileSystemId: files.fileSystemId,
posixUser: { uid: 1000, gid: 1000 },
rootDirectory: {
path: "/app",
creationInfo: { ownerUid: 1000, ownerGid: 1000, permissions: "750" },
},
});
const fn = yield* AWS.Lambda.Function("Api", {
main: "./src/handler.ts",
vpc: { subnetIds: [subnetId], securityGroupIds: [securityGroupId] },
fileSystemConfigs: [
{ arn: accessPoint.accessPointArn, localMountPath: "/mnt/files" },
],
});