One of the drawbacks of AWS Lambda is the cold start. The solution to this is to have an wakeup Lambda. This repo is an example of wakeup Lambda that wakes up other Lambdas.
This is the high level architecture of NJ2JP, an e-commerce application. This application is completely powered by AWS Lambda. You can see, there is a wake-up Lambda next to main lambda in the private subnet.
This is the specific architecture of the wake-up Lambda. You can see that the wake-up Lambda periodically warms up all other Lambdas.
- Duplicate the
config.copy.yml
file and rename it asconfig.yml
. Add your function names and make sure you refer those names in theserverless.yml
. - Once you have added your function names to environment variables, add proper payload to those functions in the
handler.js
. - Deploy the wake-up lambda using
sls deploy
command. - This will deploy the wake-up Lambda and will invoke the lambda at the specified interval of time.