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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cdk-aws-lambda-powertools-blueprint

v1.0.0

Published

AWS CDK Blueprint to add AWS Lambda Powertools configuration to Lambda Functions.

Readme

CDK AWS Lambda Powertools Blueprint

This Blueprint enables Function constructs defined in your Stack to have all the necessary properties configured to take advantage of Powertools for AWS Lambda.

Benefits

Including the PowertoolsFunctionDefaults in your property injectors will apply the following defaults to all Functions in your Stacks.

  • The official Powertools Lambda Layer (only on NodeJS and Python runtimes).
  • The POWERTOOLS_SERVICE_NAME environment variable automatically set to the provided functionName.

Usage

Different Lambda Function runtimes will take advantage of different behaviour, demonstrated in each section.

In general, you will just need to add PowertoolsFunctionDefaults to your propertyInjectors. You can add it to the App instance to cover all your stacks;

import { App } from "aws-cdk-lib";

import { PowertoolsFunctionDefaults } from "cdk-aws-lambda-powertools-blueprint";

const app = new App({
  propertyInjectors: [new PowertoolsFunctionDefaults()],
});

Or you can add it to individual Stack instances for more granular control;

import { App } from "aws-cdk-lib";
import { MyStack } from "../lib/myStack.ts";
import { PowertoolsFunctionDefaults } from "cdk-aws-lambda-powertools-blueprint";

const app = new App();

const stack = new MyStack(app, "MyStack", {
  propertyInjectors: [new PowertoolsFunctionDefaults()],
});

NodeJS Functions

Both Function and NodejsFunction constructs are supported with the NODEJS Runtime Family. If you opt to use the latter, you will also benefit from the bundling props being updated to exclude the @aws-lambda-powertools/* modules from the final bundle. This will have the benefit of reducing the final bundle size, which can lead to performance improvements.

import { App } from "aws-cdk-lib";
import { Runtime } from "aws-cdk-lib/aws-lambda";
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";

import { PowertoolsFunctionDefaults } from "cdk-aws-lambda-powertools-blueprint";

const app = new App({
  propertyInjectors: [new PowertoolsFunctionDefaults()],
});

const stack = new Stack(app, "MyStack");

const fn = new NodejsFunction(stack, "MyFunction", {
  functionName: "service-my-function",
  runtime: Runtime.NODEJS_22_X,
});

You can also select a specific Powertools version if you don't want to use the latest version of the Lambda Layer. For example;

import { App } from "aws-cdk-lib";

import { PowertoolsFunctionDefaults } from "cdk-aws-lambda-powertools-blueprint";

const app = new App({
  propertyInjectors: [
    new PowertoolsFunctionDefaults({
      powertoolsVersion: "2.30.0",
    }),
  ],
});

Python Functions

All Function constructs with the PYTHON Runtime Family will have the latest Lambda Layer appropriate to the configured architecture applied. If no architecture is applied, the function will fall back to x86_64 architecture and a warning will be added to your stack annotations.

import { App } from "aws-cdk-lib";
import { Function, Runtime } from "aws-cdk-lib/aws-lambda";

import { PowertoolsFunctionDefaults } from "cdk-aws-lambda-powertools-blueprint";

const app = new App({
  propertyInjectors: [new PowertoolsFunctionDefaults()],
});

const stack = new Stack(app, "MyStack");

const fn = new Function(stack, "MyFunction", {
  functionName: "service-my-function",
  runtime: Runtime.PYTHON_3_13,
});

All other runtimes

Every Function runtime is supported, but at the time of writing no others have a Lambda Layer to apply to the function. As a result, only the POWERTOOLS_SERVICE_NAME environment variable will be added to any function that is configured with a different runtime than NodeJS or Python.

import { App } from "aws-cdk-lib";
import { Function, Runtime } from "aws-cdk-lib/aws-lambda";

import { PowertoolsFunctionDefaults } from "cdk-aws-lambda-powertools-blueprint";

const app = new App({
  propertyInjectors: [new PowertoolsFunctionDefaults()],
});

const stack = new Stack(app, "MyStack");

const fn = new Function(stack, "MyFunction", {
  functionName: "service-my-function",
  runtime: Runtime.JAVA_21,
});

Development

If you wish to contribute to this project, please follow the Contribution guidelines.

Install dependencies

npm install

Build the package

npm run build

Run unit tests

npm run test

Run linting checks and fix linting issues

npm run lint
npm run lint:fix