BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News AWS Lambda Layers and Runtime API: beyond Officially Supported Runtimes

AWS Lambda Layers and Runtime API: beyond Officially Supported Runtimes

This item in japanese

Bookmarks

AWS re:Invent 2018 had numerous announcements of new features and services, including Lambda Layers, to centrally manage code and data shared across functions, and the Lambda Runtime API, expanding AWS Lambda beyond the list of officially supported runtimes like JavaScript, Java and C# to any programming language.

Before Lambda Layers, it was necessary to package and deploy shared code with all functions using it. Instead, Lambda Layers allow developers to place common components in a zip file and upload the resource as a Lambda Layer.

Layers generally work predictably. For example, Layers may be versioned to manage updates, and each version is immutable. When configuring a function, it can reference up to five layers, one of which may be a runtime. The order in which layers get invoked is relevant as each layer could overwrite functionality in the previous layer. Danilo Poccia, technical evangelist at Amazon Web Services, explains:

The first layer can be a runtime and the second layer adds specific versions of the libraries you need.

Lambda Layers allow developers to enforce separation of concerns between dependencies and custom business logic, make function code more focused, and accelerate deployments as dependencies may get reused.

The AWS team provides a few example layers including NumPy and SciPy, popular scientific libraries for Python, to help accelerate developer efforts for data processing and machine learning applications. Third parties provide Lambda Layers for application monitoring, security, and management.

AWS Lambda Layers provide the foundation for the even more significant announcement, which is that Lambda code can now leverage a non-JavaScript runtime. The Runtime API layer provides communication between source code in an alternative programming language and the Lambda environment, or other JavaScript environments such as the N|Solid Node.js Lambda Runtime environment from NodeSource.

Communication between a runtime bootstrap uses an HTTP-based interface to get an event payload for a new invocation, returning the response from the function.

With the initial announcement, there are C++, Ruby, and Rust runtime environments available now. AWS is working with partners on environments for other runtimes including Erlang (Alert Logic), Elixir (Alert Logic), Cobol (Blu Age), Node.js (NodeSource N|Solid), and PHP (Stackery). Additional languages for the future should use the Lambda Runtime API.

Community support has been positive with the initial Lambda Runtime announcement. Kelsey Hightower, staff developer advocate at Google, explains his experience with Lambda Runtime on Twitter:

After building my first custom Lambda runtime, it's safe to say AWS hit a home run, the Lambda Runtime API is a game changer. Given the combination of the Lambda Runtime API and Lambda Layers, I no longer believe adding support for containers would add any additional benefit to Lambda. The Lambda Runtime API provides a major benefit over containers for Serverless workloads: a well defined and opinionated runtime API for getting work done.

AWS Lambda Layers and Runtime may get used via the AWS console or AWS CLI. The AWS Serverless Application Model (SAM) and the SAM CLI may also get used to test, deploy and manage applications with these new Lambda features.

Rate this Article

Adoption
Style

BT