AWS recently announced that Lambda functions now support up to 10 GB of ephemeral storage that is preserved for the lifetime of the execution environment. The feature will help customers that run data workloads such as media processing, machine learning inference or financial analysis.
Channy Yun, principal developer advocate at AWS, explains the previous challenge:
Data-intensive applications require large amounts of temporary data specific to the invocation or cached data that can be reused for all invocation in the same execution environment in a highly performant manner (...) Since customers could not cache larger data locally in the Lambda execution environment, every function invoke had to read data in parallel, which made scaling out harder for customers.
The Lambda execution environment provides an ephemeral /tmp file system that can be used as a transient cache for data between invocations. By default, the platform allocates 512 MB for a function’s temporary directory but the value can be increased using the console, the CLI, or a SDK up to 10 GB. Simon Crosby, CTO at Swim, is not convinced about the advantages:
Just use stateful web services and ditch the slow round-trip time to storage! AKA "memory is your ephemeral store".
Source: https://aws.amazon.com/blogs/aws/aws-lambda-now-supports-up-to-10-gb-ephemeral-storage/
As covered by James Beswick, principal developer advocate at AWS, Lambda supports other three data storage options: S3, Lambda layers and the elastic file system EFS. Bryson Tyrrell, technical lead at Jamf software, asked:
What are the use cases for 10 GB in a Lambda Function? Is this targeted to the AI/ML crowd?
Tyrrell received many suggestions, from video transcoding to AI/ML workloads, from lift and shift of existing applications to increasing AWS revenue. Randall Hunt, VP of cloud strategy and solutions at Caylent, compares the cost of running serverless functions and containers on AWS:
AWS Lambdas are now configurable up to: 10GB deployment size, 10GB RAM (6vCPU), 10GB /tmp and 15 minute runtime. So your most expensive per-invocation lambda cost ends up: ~$0.13. On Fargate, nonspot, (4vCPU) that same task: ~$0.07. Worth it? Totally depends on the workload.
Luc van Donkersgoed, lead engineer at PostNL, focuses instead on the cost of the ephemeral storage:
Did some calculations on ephemeral storage pricing, and I must say: it's very, very reasonable. In an extreme case (512MB mem, 10GB storage) the storage is 3,73% of the execution cost. When mem and storage are configured as equal values, storage is only 0,19% of the cost.
Developers can configure the size of the ephemeral storage in all AWS regions where AWS Lambda is available and are charged for the storage above the 512 MB free limit for the duration of the function invocation.