Storing the state

As mentioned previously, Lambda functions have to be designed in a stateless manner.

During the time of execution, the Lambda function has access to the memory and local filesystem, but after it terminates, the contents of that memory location are wiped away. It's impossible to get a handle on the same memory space during the next execution.

As a consequence of this mandate, it becomes incumbent on the developer to store the computational results of an execution in a cloud storage service, like S3 or DynamoDB, should they be required for downstream processing at a later time.

Get Hands-On Serverless Applications with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.