Attend a Live Product Tour to see Sedai in action.

Register now

Understanding Lambda Extensions



Published on
Last updated on

April 1, 2024

Max 3 min
Understanding Lambda Extensions

This blog is based on a transcript of a talk by Shridhar Pandey of AWS at Sedai's autocon conference.


Hello everyone! In this article, we'll be exploring an important topic: Lambda Extensions. These extensions are a powerful feature that was introduced last year. So, let's jump straight into it and understand the details of this valuable addition.

Throughout this blog, I'll make sure to provide you with concise and informative insights. We will uncover the reasons behind the development of Lambda Extensions, understanding what drove its creation. We will then take a closer look at what these extensions actually are, giving you a clear overview of their functionality. Moreover, we will cover the wide range of use cases they can address, showcasing their versatility. Lastly, I'll guide you through the process of getting started with Extensions, ensuring you have the necessary tools to explore this feature on your own. So, let's start discovering more about Lambda Extensions. You can watch the full video here.

Seamless Integration of Operational Tools with Lambda

The motivation behind building Lambda Extensions stemmed from a few different reasons, but the core idea was to empower our customers to use their preferred operational tools on Lambda without adding any extra operational burden or requiring complex configurations. Our philosophy is to allow you to focus on developing your application logic while leaving the heavy lifting of tooling to specialized vendors. This formed the foundation of Lambda Extensions.

We also listened to feedback from customers who expressed the need for simplified operational tooling on Lambda. We embarked on a mission to create an ecosystem of operational tools around Lambda, making it easier for organizations and customers to bring their existing tools to the platform. We wanted to streamline the process, whether customers desired to utilize their own tooling or build their own. With this goal in mind, we launched Lambda Extensions last year. We initially previewed it in October 2020 and made it generally available in May 2021.

In essence, Lambda Extensions offer a straightforward method for integrating various operational tools, whether developed internally or provided by independent software vendors (ISVs), with the Lambda execution environment. This execution environment is where your Lambda function code runs. The purpose is to simplify the configuration and installation of these tools, and that's where Extensions come into play. In terms of use cases, we envisioned Extensions being particularly useful for monitoring, observability, security, and governance. We've witnessed customers leveraging these use cases, and both Lambda partners and ISV tooling partners have built and support Extensions for them.

Under the Hood and API Functionality

So, let's explore what Lambda Extensions are and how they work under the hood. In the image you see here, the box on the left with the Lambda sign represents the Lambda service itself. On the right-hand side, you'll notice several boxes that collectively represent the execution environment. This environment is where your function code, runtime code, and Extension code operate. The platform takes care of initiating and managing the execution environment's life cycle, and communication with the platform occurs through APIs, such as the runtime API.

With the introduction of Extensions, we added additional APIs to the mix. In the pre-Extensions world, the runtime in the function code communicated with the platform using the runtime API. However, with Extensions, you can now run tools or agents in parallel with the runtime and function code. These agents operate independently from the function code and communicate with the Lambda platform through a new API specifically designed for Extensions.

The Extension agent can be initialized even before the function code itself, enabling it to run in parallel throughout the entire function invocation process. It can continue running even after the function code has completed its execution, allowing for tasks like cleanup or collecting telemetry data. For example, an Extension could use the post-invocation period to send the function's response back to a backend or perform other post-execution actions. Many Extension authors utilize this model to integrate their extensions effectively. Additionally, we introduced the Logs API, which offers exciting capabilities. By default, the Lambda service generates logs for your function, which are stored in CloudWatch Logs. However, with the Logs API, Extensions gain direct access to the logs generated by both the function code and the Lambda service. This means that if you're running an Extension within the Lambda execution environment and want to collect and send logs to your backend, you can do so without solely relying on CloudWatch Logs. The Logs API provides more flexibility and control in managing your function's logs.

The Extensions API and Logs API collectively form part of the Extensions offering. Now that we have an understanding of what Lambda Extensions are and how they work, let's delve into their lifecycle and timeline representation.

As we observe the diagram, let's delve into its details. Firstly, notice the line that distinguishes what is managed by the Lambda service and what falls under the responsibility of your Extensions within your code. This line reflects the shared responsibility model of AWS Lambda, where the platform manages certain aspects while you maintain control over your code, including any extensions.

Now, focusing on the left side of the diagram, you'll notice that extension initialization takes place even before the runtime or function code is initialized. This initialization phase concludes when both the function code, runtime, and extension initialization are completed, or when a timeout occurs, depending on whichever comes first. Once this initialization process is finalized, and an invocation or request is received, indicated by the invocations depicted, assuming the function is properly initialized, both the function and the extension operate in parallel. A series of invocations will occur, facilitating the execution of the function and the extension simultaneously.

AWS Services, ISV Partners, and Open-Source Solutions

There are multiple ways to utilize extensions, providing flexibility based on your specific needs. Firstly, as mentioned earlier, you have the option to build your own extensions or leverage ready-to-use extensions offered by our trusted tooling vendors, who are our partners.

Let's explore some of the available extensions. AWS provides services like CloudWatch, which offers the CloudWatch Lambda Insights extension for enhanced monitoring. AWS AppConfig offers an extension that enables feature flagging and other useful functionalities. The AWS CodeGuru Profiler extension helps with profiling function code, while the AWS Distro for OpenTelemetry provides the OpenTelemetry collector as an extension.

In addition to these AWS extensions, we have partnered with several Independent Software Vendors (ISVs) who offer certified extensions. These extensions have undergone a rigorous evaluation process and can be used directly from the respective vendors. To use them, you typically include the provided extensions as layers within your function code configuration. If you're looking for open-source solutions, there are also various open-source extensions available for download and personal use. And if you can't find an extension that perfectly fits your requirements, you have the option to build your own Lambda extension. Our documentation provides detailed information on extensions, including a list of available extensions and examples to guide you through the process of building and running your own extension.


Lambda Extensions open up a world of possibilities for streamlining your operational processes, enhancing monitoring and observability, strengthening security, and enabling seamless integration with your preferred tools. Whether you choose to leverage existing extensions, explore partnerships with ISV tooling vendors, or embark on building your own extensions, the power is in your hands to optimize your Lambda functions and focus on what truly matters—building exceptional applications. I encourage you to look into the versatility of Lambda Extensions and unlock the full potential of your serverless architecture today.

Was this content helpful?

Thank you for submitting your feedback.
Oops! Something went wrong while submitting the form.