Skip to main content

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

upload-artifacts-and-release-new-version PyPI version

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

py_lambda_warmer-0.1.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_lambda_warmer-0.1.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file py_lambda_warmer-0.1.3.tar.gz.

File metadata

  • Download URL: py_lambda_warmer-0.1.3.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

Hashes for py_lambda_warmer-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b06b808ee6d32d6a491d45e0536b997541c24f2a131c69356b63ea51fba5e5ca
MD5 22288088e48fce08db66e981dd865dcc
BLAKE2b-256 21ea9683f838d5a175a8cfb8918a70233d45c04bca3357495f61d00c6acb29f3

See more details on using hashes here.

File details

Details for the file py_lambda_warmer-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for py_lambda_warmer-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aefa12eb9f2707a44839a25652cec08bb989d6a95ecdbfe153d450f7a6c1823b
MD5 2844e6f2a4b5ce5da9ee2efe671dcd15
BLAKE2b-256 2c9b3d66980dc3c854718212adc0f8c82eace420b6a1de4e73d34e56885d7b09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page