AWS EFS with SQLite
Mount an EFS file system to a function and write to a SQLite database.
const db = sqlite3("/mnt/efs/mydb.sqlite");The file system is mounted to /mnt/efs in the function.
This example is for demonstration purposes only. It’s not recommended to use EFS for databases in production.
// NAT Gateways are required for Lambda functionsconst vpc = new sst.aws.Vpc("MyVpc", { nat: "managed" });
// Create an EFS file system to store the SQLite databaseconst efs = new sst.aws.Efs("MyEfs", { vpc });
// Create a Lambda function that queries the databasenew sst.aws.Function("MyFunction", { vpc, url: true, volume: { efs, path: "/mnt/efs", }, handler: "index.handler", nodejs: { install: ["better-sqlite3"], },});View the full example.