Hands-On Serverless Applications with Kotlin
上QQ阅读APP看书,第一时间看更新

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.