Cache table data for Lambda Processing

0

Hello All,

I have use case where in I have table in AWS postgres database . This is configuration table ( few rows even less than 100 ) and data stored in this table will be used by lambda for some processing . Now lambda has to run multiple times so I don't want it to go and read the table every time from database . Is there a way to cache the table data (apart from Redis option) for lambda processing . I was going through AWS extension https://github.com/aws-samples/aws-lambda-extensions/tree/main/cache-extension-demo but here in config file dynamoDB is mentioned . What do I need to mention for RDS . Can we even use it for my use case ? Does Anyone has working example .

Is there any other way we can resolve this ?

asked a year ago438 views
2 Answers
0

Hello, I was thinking that you might just capture that config data into a JSON file in your /tmp directory - like /tmp/config.json

Then your Lambda function would first check for the existence of that file before it queries the database. Would that work for your use case? As long as the Lambda is being warm started, I believe the /tmp folder will remain intact on the next invocation.

answered a year ago
  • Hello @patrick but data in config file can change so I want to use new changed data without any deployment effort.

0

Hi,

I see a few options, of course depending on your case.

Hope it helps!

profile picture
EXPERT
answered a year ago
profile pictureAWS
EXPERT
kentrad
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions