loading...

Lambda Extensions: What Are They, And Should You Care?

loujaybee profile image Lou — Cloud Engineer Originally published at thedevcoach.co.uk on ・5 min read

This month AWS announced a new feature called Lambda Extensions (Source). AWS release so many features it is hard to keep up. With each new feature we often need to ask ourselves, is this something we should pay attention to or not?

What is Lambda Extensions, and who should pay attention to it? Lambda Extensions are an addition to the Lambda Runtime API, allowing additional control, setup and tooling. Lambda Extensions are mainly aimed at third-party vendors, particularly monitoring but also configuration and security. Lambda Extensions will also be interesting to heavy users of AWS Lambda functions who need standardisation or greater control on their setups.

Now let’s get into more detail on what Lambda Extensions actually are to help you understand whether or not they might be useful in your situation. Let’s start by looking at a core difficulty that Lambda Extensions help solve.

Why Are Lambda Extensions Useful?

To understand the use case behind Lambda Extensions, let’s take a look at the world before Lambda Extensions using the main use case: monitoring.

In a server world, to extract custom telemetry, it was typical to use an agent, installed in the background of a server to periodically send data to monitoring platforms, hopefully avoiding impact to the application code in the process.

However, in the AWS Lambda world there were only two (not so great) options to achieve similar functionality to an agent:

  1. Synchronous Sending — Telemetry data is sent during the lifetime of the Lambda function. Sending data synchronously isn’t ideal as it can pass on latencies to the end-user if the function is user-facing.
  2. Asynchronous Sending — Telemetry data is logged to CloudWatch and processed later by parsing that data within CloudWatch. But, parsing data like this can add additional cost through CloudWatch, and adds a time lag before data arrives in the monitoring platform.

And it’s difficulties like this—sending telemetry data—which influenced AWS to introduce Lambda Extensions. Now, let’s take a look at what Lambda Extensions actually are in practice.

What is Lambda Extensions?

Lambda Extensions

Lambda Extensions (Source)

Lambda Extensions is an addition to the existing runtime API of AWS Lambda. Lambda Extensions allow additional logic to be ran before, during and after a functions invocation. You can use Lambda Extensions for: capturing additional monitoring data, fetching secrets and configuration or running security software.

Lambda Extensions come in two main flavours: internal and external. Internal Extensions run in the same process as the Lambda function, whereas external run in a separate process. Each Lambda Extension type has different pro’s and con’s, i.e external Extensions can be written in a different language to the function since they’re operating a separate process (Source).

So by now you might be wondering: “what are some of the practical use cases for Lambda Extensions?”

Use Cases For Lambda Extensions

There are really three broad categories of use for Lambda Extensions: monitoring, configuration and security.

  1. Monitoring — Lambda Extensions can be used to send additional telemetry data about a running lambda function whilst having less impact on the behaviour of the running function. For instance, check out Lumigo’s Lambda extension which extracts data like CPU usage.
  2. Configuration — Lambda Extensions can be used to help configure and setup a Lambda on start-up, such as by loading in configuration data, such as secrets. For instance, check out this Lamba Extension for fetching secrets from AWS secrets manager. or this Lambda Extension that pulls secrets from Hashicorp Vault.
  3. Security — Lambda Extensions can be used for security as an additional layer to enforce security restrictions for instance by inspecting requests made from a Lambda function.

Now that we know more about what Lambda Extensions is and the main use cases, you may be thinking about the other details such as as the impact of Lambda Extensions on cost, performance, etc. Let’s cover that now.

Key Information About Lambda Extensions

Lambda Extensions can have an impact on performance and cost.

  • Lambda Extensions are distributed as Lambda Layers.
  • There’s a limit of 10 Lambda Extensions per function.
  • The size of the Extensions contribute to the 250MB Lambda limit.
  • Extensions share resources (CPU, Memory & Network) with the Lambda, meaning Lamba Extensions can impact the performance of a Lambda.
  • There’s no additional cost for Lambda Extensions, the cost of Extensions are factored in as part of the resource usage of the Lambda.

And that covers most of what Lambda Extensions are. If you’re interested to know more, I’ve got some links that might be useful for you to check out.

Useful Resources

Should You Care About Lambda Extensions?

And that’s all we’re going to cover for today. I’m hoping you now have a better understanding of what Lambda Extensions are, and you can make a decision about whether they are or aren’t useful to you right now.

Lambda Extensions will be most interesting to you if you’re a third-party or vendor of monitoring, security or configuration. Or, if you work on an internal or a platform team in a company running lots of AWS Lambda functions who want greater control and standardisation of your Lamba functions.

The likelihood for most is that Lambda Extensions aren’t something worth paying too much attention to (just yet). You may find that you integrate them into your existing functions but you shouldn’t need to know all the fine details.


The post Lambda Extensions: What Are They, And Should You Care? appeared first on The Dev Coach.

If you’re interested in Cloud I write a monthly newsletter for Cloud Software Engineers. I spend the month digging around the internet for the best cloud engineering content and provide a monthly summary. I read every article I share, and I focus on fundamentals as much as possible.

Discussion

pic
Editor guide