Amazon announces AWS Lambda Powertools TypeScript

Amazon recently announced the AWS Lambda Powertools TypeScript Beta. The utility set for Node.js Lambda functions helps developers follow best practices for tracing, structured logging, and custom metrics.

AWS Lambda Powertools is a open-source project composed of three modules: Tracer, a suite of utilities for tracking Lambda handlers and synchronous/asynchronous functions, Recorder, a middleware for adding Lambda context details to log items and Metric, custom metrics created with CloudWatch Embedded Metric Format (EMF). Sara Gerion, Senior Solutions Architect at AWS, summarizes in a Tweeter the main scenarios for the Logger module:

Capture key fields from Lambda context, cold start, and structure logging output in JSON format. Save the Lambda context when prompted. Log sampling prints all logs for a percentage of calls. Add keys to the structured log at any time.

and explain how the metric and tracer can help, by capturing responses and aggregating metrics into a single CloudWatch EMF object. In a Reddit thread, the user Okay party the announcement:

The only thing that kept me from switching to Typescript Lambdas. Finally!

The new library provides a set of TypeScript calls to manage Lambda functions running on a Node.js runtime and helps developers extract observability data from serverless applications. Matt Morgan, director of software engineering at PowerSchool, wrote a “First Look at Lambda Powertools TypeScript” article and suggests:

Adding all the utilities to my project seemed to add around 600 KB unminified or 200 KB to minified bundles. Considering the value and necessity of chaining certain dependencies into the AWS SDK or X-Ray SDK, this seems quite reasonable and the team has done a good job of staying true to their “Keep It Lean” principle. “. Lambda Powertools does a great job of focusing on the kinds of utilities that developers really need to improve their applications and follow best practices.

matt lewis, Chief Architect at DVLA, adds:

What I like about AWS Lambda Powertools is that it allows you to develop a new project that follows the best practices defined in the well-architected framework’s serverless goal (…) It’s an awesome new library for anyone who develops Lambda functions in JavaScript.

JavaScript is not the first language supported by Lambda Powertools, AWS has already released versions for Python and Java. The project is currently a beta preview for developers, with a public roadmap and one production ready due out later this year.

Margie D. Carlisle