I have a Lambda that is generating and returning a value. This value can expire. Therefore I need to check the values validity before returning. As generating is quite expensive (taken from another service) I'd like to store the value somehow.
What is the best practice for storing those 2 values (timestamp and a corresponding value)?
Whats best practice here? Whats the way to go in terms of performance?
Amazon EFS for Lambda Amazon EFS is a fully managed, elastic, shared file system that integrates with other AWS services. It is durable storage option that offers high availability. You can now mount EFS volumes in Lambda functions, which makes it simpler to share data across invocations.
One of the important things to keep in mind when developing lambdas is that they must be single-purpose. Deriving from the Single Responsibility Principle (SRP), “each lambda must be non-trivial, have a unique responsibility and encapsulate an axis of change”. A lambda should be non-trivial.
Today, we are announcing that AWS Lambda now allows you to configure ephemeral storage ( /tmp ) between 512 MB and 10,240 MB. You can now control the amount of ephemeral storage a function gets for reading or writing data, allowing you to use AWS Lambda for ETL jobs, ML inference, or other data-intensive workloads.
Use DynamoDB. There is no overhead for "running a database" -- it is a fully-managed service. You pay only for storage and provisioned capacity. It sounds like your use-case would fit within the Free Usage Tier.
Alternatively, you could use API Gateway with a cache setting so that it doesn't even call the Lambda function unless a timeout has passsed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With