Warmer Utility for Lambda Function
Project description
This is a utility project designed to cater neccessities for warming up Lambda
functions to prevent cold starts.
Table Of Contents
Installing Warmer
To install module, run the below command:
python3 -m pip install py_lambda_warmer
# or
python3 -m pip install py_lambda_warmer==<release-version>
Using Warmer
This is very easy to incorporate in your existing Python Lambda Handlers. Follow the below code.
from warmer import warmer
@warmer(flag="custom_event_key")
def handler(event, context):
pass
If you handler is a Flask/FastApi application, you may follow below steps:
from warmer import warmer
from flask import Flask
app = Flask()
@warmer(flag="custom_event_key")
def application(event, context):
app(event, context)
# or
application = warmer(flag="custom_event_key")(app)
# you may now use application as your handler
warmer
will help you cater the custom events that are coming for warming Lambda function.
Setting up Event Bridge Notifications
You can also setup you custom event bridge schedule for Lambda function using the Terraform Resource
code mentioned in
the repository.
Simply download the Terraform
code attached in the release and unzip it.
wget https://github.com/satyamsoni2211/LambdaWarmerPy/releases/download/${release}/terraform_code.zip
unzip terraform_code.zip -d terraform_code/
cd terraform_code/
# creating variable file required by terraform
cat << EOF > .auto.tfvars
arn = <arn of your lambda function>
profile = <profile alias for aws>
region = <region for aws lambda>
EOF
# initiating and applying
terraform init
terraform plan -out tfplan
terraform apply tfplan
You may also modify resource names as per your requirements in the code.
Happy Warming.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file py_lambda_warmer-0.0.5.tar.gz
.
File metadata
- Download URL: py_lambda_warmer-0.0.5.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b7a466b6fccac5ac2a8ef42854338b14313ba90cc29574ad5940f0f1826ff80 |
|
MD5 | 058353e24148b4167d193a91038c417d |
|
BLAKE2b-256 | b7030fb10e02ab7ae807debbcabbe256452810bd1f3c3c7bc00558c057484efa |
File details
Details for the file py_lambda_warmer-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: py_lambda_warmer-0.0.5-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8674bcb1c233b62276975eb2650b8f74869ff50ff948ebe88811e9eeb8b1357b |
|
MD5 | aff6b0200d1647fb22e2352143707aac |
|
BLAKE2b-256 | 0b53ba33cd5e04eb221b6df9ee84ca77e8eb24f153aee6d669b9a8716a85d13a |