10 hours ago · Tech · 0 comments

Given a Lambda function’s ephemeral nature, when working with SQLite databases or other files, you would typically be baking it into the functions deployment package, reading the database from S3 using external libraries, or attaching the function to an Amazon EFS file system. The first approach would mean any changes made during the runtime of the function would be lost, given that the execution of a function is ephemeral. To persist changes to the database would require you to re-deploy the function. However, this does work well for read-only use cases, and if you remain within Lambda’s space constraints. In the next approach, reading from S3 requires using additional dependencies, which you can package into the function or import through layers. There are some good libraries today that allow this, and it is a viable option. Lastly, using a function with an EFS file system mounted allows you to read and write to the SQLite database with low latency. This, however, is the costliest…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.