Python script to warm AWS lambda for cold start problem

Viewed 1179

I followed the lambda-warmer https://github.com/jeremydaly/lambda-warmer for NodeJS to create a similar script for python:

  • Warm the lambda function every a few minutes
  • Warm more than one lambda functions if I set up the concurrency parameters

Here is my python code: https://github.com/pafun/lambda-warmer-python/blob/master/lambda-warmer-python.py

Here is a typical input:

{
    "flag": "warmer", 
    "concurrency": 10,
    "test": false,
    "delay": 300
}

Usually, the script won't warm up the exact number of instances for me unless I increase the delay time. Like the above example input, I usually get 6-8 Concurrent Executions as I observed in lambda AWS monitor.

How can I make sure the exact number of lambda instances will be warmed?

0 Answers
Related