Node js global scope

Babu Jayaraman

I have nodejs lambda which call aws parameter store to get value for a key, I wanted to call once. So try to set global value and get it in function but it failed. Any one help me. How to keep global scope for a value across lambda.

Aws nodejs lambda to call parameter store only once

Lee Hannigan

Making the request and storing the value outside of the request handler will share that variable across invocations. But as soon as that container cools off, it will need refreshed.

https://docs.aws.amazon.com/lambda/latest/operatorguide/execution-environment.html

If you want to share values indefinitely across Lambda invocations then I suggest you use a Lambda Environment Variable

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related