A Shared File System for Your Lambda Functions
- Tushar Prasad
- Aug 9, 2020
- 1 min read
AWS Lambda functions can now mount an Amazon Elastic File Systems (EFS), a scalable and elastic NFS file system storing data within and across multiple availability zones (AZ) for high availability and durability. In this way, you can use a familiar file system interface to store and share data across all concurrent execution environments of one, or more, Lambda functions. EFS supports full file system access semantics, such as strong consistency and file locking.
You can share the same EFS file system with EC2 instances, containerized applications using Amazon ECS and Fargate, and on-premises servers. Following this approach, you can use different computing architectures (functions, containers, virtual servers) to process the same files. For example, a Lambda function reacting to an event can update a configuration file that is read by an application running on containers. Or you can use a Lambda function to process files uploaded by a web application running on EC2.
In this way, some use cases are much easier to implement with Lambda functions. For example:
Processing or loading data larger than the space available in /tmp (512MB).
Loading the most updated version of files that change frequently.
Using data science packages that require storage space to load models and other dependencies.
Saving function state across invocations (using unique file names, or file system locks).
Building applications requiring access to large amounts of reference data.
Migrating legacy applications to serverless architectures.
Interacting with data-intensive workloads designed for file system access.
Partially updating files (using file system locks for concurrent access).
Moving a directory and all its content within a file system with an atomic operation.
Nicely explained
Keep up the work🙃