Recently AWS announced Lambda extensions' general availability (GA), which allows its users to integrate Lambda functions with their preferred tooling for monitoring, observability, security, and governance. The GA release includes performance improvements and an expanded set of partners.
In the fall of last year, the company announced the preview of Lambda extensions, and now it becomes GA with improvements. A significant improvement made by AWS is that functions will send responses directly once code is complete without waiting for the included extensions to finish, which means the extensions perform activities like sending telemetry to a preferred destination after the function's response has been returned. Furthermore, more extensions from other partners like Instana, Sentry, and the AWS Distro for OpenTelemetry are available.
Several use cases exist for leveraging extensions, including observability and logging - allowing the capture of diagnostic telemetry data before, during, and after a function invocation. Developers can use extensions to automatically instrument their code without any chances to get insights into how their functions are running. Furthermore, they can use extensions to fetch and cache configuration settings or other values before the function runs. Also, extensions can run as security agents to detect and alert on function activity. And lastly, extensions can send telemetry to custom destinations such as Amazon Kinesis and Amazon Simple Storage Service (Amazon S3), directly and asynchronously from Lambda functions.
Channy Yun, a principal developer advocate for AWS, explains in the blog post on the GA of Lambda extensions how they work:
Lambda extensions use the Extensions API to register for function and execution environment lifecycle events. In response to these events, extensions can start new processes or run logic. Lambda extensions can also use the Runtime Logs API to subscribe to a stream of the same logs that the Lambda service sends to Amazon CloudWatch directly from the Lambda execution environment. Lambda streams the logs to the extension, and the extension can then process, filter, and send the logs to any preferred destination.
To use Lambda extension, users can install and manage extensions using the Lambda console, the AWS Command Line Interface (CLI), or infrastructure as code (IaC) services and tools such as AWS CloudFormation, AWS Serverless Application Model (AWS SAM), and Terraform. Users can find all the available extensions, ranging from AWS Config to Splunk, when using the console through the Extensions Page.
One of the AWS partners, Lumigo, that provides extensions for Lambda wrote in their blog post on Lambda extensions:
At long last, Lambda offers background processing time. And it opens up so many possibilities for AWS partners to build extensions that take advantage of this, so you no longer have to make a trade-off between performance and see your data quickly.
AWS competitors Microsoft and Google also offer extensions for their Function offering. Microsoft recently released a preview of Azure Function Extension Libraries to integrate with other Azure Services like Storage and Event Grid. Furthermore, there are open-source libraries available for monitoring purposes, yet no extensive partner ecosystem similar to Lambda. Moreover, the same applies to Google Functions.
Currently, the AWS Lambda Extensions performance improvements as part of the GA release are available in the US East (N. Virginia), Europe (Ireland), and Europe (Milan) Regions. Furthermore, samples are available on GitHub and guidance through a series of deep-dive videos and a blog post by Julian Wood.