npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ixor/aws-cdk-lambda-warmer

v0.1.0

Published

## Description

Downloads

2

Readme

Lambda Warmer Lambda: Keep your Lambda's warm

Description

This repo contains a AWS CDK stack that can be deployed to any AWS account. The stack contains a single Lambda and IAM permissions to allow CloudWatch Events to invoke the function, and the function to invoke all Lambda's in the account/region where the stack is deployed.

You should, preferably in an automated way, create a AWS CloudWatch event for every function you want to be warm. The event to sent to the KeepWarm lambda looks like this:

{
  "lambdaArn": "arn:aws:lambda:eu-central-1:123456789012:function:functionToKeepWarm",
  "count": 5
}

When the KeepWarm function is invoked by the CloudWatch Rule, this wil happen:

  • the event is read and interpreted
  • the KeepWarm function asynchronously invokes the Lambda to be kept warm count times with a dummy event containing 2 properties dummy and dummySleepSeconds
  • the target Lambda will interpret the dummy event, and will sleep for the requested amount of seconds
  • without the sleep, the target Lambda might have already finished before the next invoke by the KeepWarm lambda, resulting in less than desired warm lambda's

Deploying this AWS CDK stack

To deploy the KeepWarm Lambda on a AWS account:

  • set credentials with sufficient permissions
  • make sure all requirements are met
    • aws-cdk is installed
    • aws-cli is installed
  • run this command:
cdk deploy

How to change your Lambda to correctly process the dummy event

  • Check for the dummy property in the incoming event
  • Sleep for dummySleepSeconds seconds (default to 1)
  • Return immediately after the sleep

Links and Resources

  • https://www.npmjs.com/package/@ixor/aws-cdk-ixor-lambda