Reputation: 1164
We have a library that gives us access to some external API, but it has a very long initialisation time. Also there is no way to initialize it with some session key or anything that could be stored, it always has to go through the whole initialisation process.
Is there a way to have the library initialized only once and then used across all lambda functions?
If we were somehow able to inject the session by reverse engineering the code, where would the session data be stored best? In DynamoDB, stage variables, something else?
Upvotes: 1
Views: 4897
Reputation: 2355
lambda_handler
handler can be used in the consecutive invocation provided the same container is used by aws. Not sure if that's going to be ok with your case. Since once the container is destroyed by aws then the next invocation done after that will have to again go through a re-initialization. This will all depend upon how often is this service going to be used or how busy its going to be. Upvotes: 3