Posted On: Nov 20, 2020
You can now use Amazon Lambda with extensions for your favorite operational tools for monitoring, observability, security, and governance.
Lambda makes it easy for developers and operators to focus on their business needs by reducing their operational overhead. To help customers operate their functions, Lambda provides native integrations for logs and metrics through Amazon CloudWatch, tracing through Amazon X-Ray, tracking configuration changes through Amazon Config, and recording API calls through Amazon CloudTrail. However, previously, customers who wanted to use non-Amazon Web Services offerings told us it was complicated to integrate Lambda with other operational tools.
Extensions are a new way for tools to more easily integrate deeply into the Lambda execution environment to control and participate in Lambda’s lifecycle. They use the Extensions API, a new HTTP interface, to register for lifecycle events and get greater control during function initialization, invocation, and shutdown. They can also use environment variables to add options and tools to the runtime, or use wrapper scripts to customize the runtime startup behavior.
You can use extensions from Amazon Web Services, third party vendors, and open source projects for a wide range of use cases. For example, you can simplify your development workflow by automatically instrumenting Lambda functions without needing code changes or by deploying operational tools independently of code changes. Also, you can improve performance of your functions by pre-fetching configuration and secrets before your function handler is executed, or send telemetry to a custom destination outside of the function invocation. Extensions for tools like logging agents can also use the new Amazon Lambda Runtime Logs API (in preview) to subscribe to log streams directly from within the Lambda execution environment, and then process, filter, and send them to any preferred destination.
Extensions share the same billing model as Lambda functions. When using Lambda functions with extensions, you pay for requests served and the combined compute time used to run your code and all extensions, in 100ms increments. To learn more about the billing for extensions, visit the Lambda FAQs page.
You can deploy extensions using Layers through the Lambda Console, CLI, or infrastructure as code tools such as CloudFormation, the Amazon Serverless Application Model, and Terraform. You can build your own extensions as well. To learn how to build extensions using the Extensions API, visit the Amazon Lambda Developer Guide.