2 Answers
- Newest
- Most votes
- Most comments
1
Check out this engaging post on caching data and configuration settings with AWS Lambda extensions: Caching Data and Configuration Settings with AWS Lambda Extensions.
0
There is no builtin caching mechanism as you describes. You have a few options:
- In the Lambda function itself, save the data that you read in a static variable. This will allow you to read it only once per function instance. Each instance will need to read its own copy. You do not have an automatic way to refresh the cache. You can include some TTL that if it passed, you will get the file again next invocation.
- Use some write aside cache, like DynamoDB (Depending on the side of the data, as it supports up to 400 KB per item), or Elasticach. Your functions will first check if it is in the cache, if it is, they read it from there. If it is not, they read from S3 and update the cache. To update the cache when the files in S3 are updated, you need a second function that waits for object updates and it will update the cache.
Relevant content
- Accepted Answerasked 9 months ago
- asked 9 days ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
@Uri - thanks . do you know of any blogs/examples of similar use case that you can point me to.
Found this external blog. I think it is relevant. Also this one.