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.
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.