Skip to main content

Simple python package for keeping your lambda functions warm using an eventbridge schedule

Project description

🍞 Toasty - The Lambda Warmer

Toasty is a simple Python library designed to keep your AWS Lambda functions warm using an EventBridge schedule. It provides a decorator @toasty for your Lambda functions and a CDK construct LambdaWarmer for setting up the warming schedule.

Installation

You can install the Toasty library using pip:

pip install toastypy

Usage

Toasty Wrapper

The @toasty wrapper can be used to decorate your Lambda functions. Here's an example:

from toastypy.toastypy import toasty

@toasty
def my_lambda_function(event, context):
    # Your function logic here
    pass

LambdaWarmer CDK Constuct

The LambdaWarmer construct can be used in your CDK stack to set up the warming schedule for your Lambda functions. Here's an example:

from aws_cdk import aws_lambda as _lambda
from toastypy.constructs.lambda_warmer import LambdaWarmer

# Assuming `app` and `stack_id` are your CDK app and stack ID
my_lambda = _lambda.Function(
    app, "MyLambdaFunction",
    # Lambda function properties here
)

LambdaWarmer(
    app, "MyLambdaWarmer",
    lambda_to_warm_arn=my_lambda.function_arn,
    concurrency=20,
    environment="nonprod",
)

In this example, LambdaWarmer is set up to warm my_lambda function. The concurrency parameter specifies how many concurrent executions to use for warming, and environment is an optional parameter for specifying the environment.

Please refer to the LambdaWarmer and toasty in the source code for more details.

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

toastypy-0.0.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

toastypy-0.0.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file toastypy-0.0.3.tar.gz.

File metadata

  • Download URL: toastypy-0.0.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for toastypy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a129d403758088ab33cc5552b4b16b9a53a8369129357759af421e32a4e25391
MD5 98846edf05d966722e787fbd6f39aa91
BLAKE2b-256 f1d0bd63c77709dcd30d86a93f11e4c314f05542ad38448d52b1663848100c78

See more details on using hashes here.

File details

Details for the file toastypy-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: toastypy-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for toastypy-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 957946263d54aba9173ee75de8a81686b81404e9a1debbf92a0d383760b9c814
MD5 0a039cc49cf95a7fe0c90726c6757e4a
BLAKE2b-256 5a17cb97942449839c6391e249bb14256780e8a88626ca73529e3864295852b3

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