Story image

How AWS Lambda enables sharing common code between functions

03 Dec 2018

AWS announced Lambda Runtime API and Lambda Layers, two new AWS Lambda features that enable developers to build custom runtimes, and share and manage common code between functions. 

Lambda supposedly makes it easy for developers to run code for virtually any type of application or back-end service.

The Runtime API for AWS Lambda defines a standardised HTTP-based specification which codifies how Lambda and a function’s runtime communicate. It enables users to build custom runtimes that integrate with Lambda to execute functions in response to events. 

By leveraging the Runtime API, businesses can use binaries or shell scripts, and their choice of programming languages and language versions. 

During an invoke, Lambda will bootstrap the user’s runtime code and communicate with it over Runtime API to execute the function code. With this release, AWS is also publishing a reference implementation of the C++ and Rust runtimes. Users can read more about the Runtime API in the Lambda documentation.

Lambda Layers are a new type of artifact that can contain arbitrary code and data and may be referenced by zero, one, or more functions at the same time. 

Lambda functions in a serverless application typically share common dependencies such as SDKs, frameworks, and now runtimes. With layers, users can centrally manage common components across multiple functions enabling better code reuse. 

To use layers, businesses simply put their common code in a zip file and upload it to Lambda as a layer. They can then configure their functions to reference it.

When a function is invoked, the layer contents become available to their function code. AWS is also providing a layer which includes the popular NumPy and SciPy scientific libraries for Python. These libraries were prebuilt and optimised for use in Lambda’s execution environment. 

By using this layer with Python functions, users can quickly get started with building complex data processing and machine learning applications.

Runtime API and Layers can be used independently. Users can also use them together to publish custom runtimes which can be then shared as layers.

They can also use the AWS Serverless Application Model (SAM) and SAM CLI to test, deploy and manage serverless applications that leverage Runtime API and Layers. 

With this release, several of AWS’ technology partners are also launching their offerings on top of Runtime API and Layers. 

Customers can author functions in new runtimes and layers, including those which support additional capabilities including application management, monitoring, and security.

Unisys encourages financial institutions to adopt open banking
“It establishes the bank as an integral part of the customers’ life – a ‘one-stop-shop’ where they can get personalised products and services they want, when they want them.”
Developers use Intel AI to solve some of the world’s biggest challenges
Risab Biswas developed a computer vision application to help farmers more easily detect pathological disease in their plants.
Smarter cities through cross-border and G2G collaborations
"As countries race ahead in their bid to accelerate smart city development through industrialisation, the environment and ultimately humanity is paying the price for this phenomenon."
SingularityNET CEO discusses the future of AI
"In my view, AI will eliminate essentially all need for humans to do practical work."
You're invited: Adobe Symposium 2019, Sydney
The event will bring together 4000 business leaders, marketers, IT and digital experts, as well as creative professionals to Sydney’s International Convention Centre in the heart of the city.
Toshiba launches fast rotary cutter for B-EX6T1 printer
Intended primarily for industrial applications, these popular printers combine state-of-the-art technology with usability, reliability and low TCO.
How the 5G Telco market is transforming
"Over the past six months, more people in the general populace have begun using the term 5G in their regular conversations."
Innodisk launces AIoT solution for the medical field
One of the challenges of AIoT is keeping tabs on the many devices involved in the system.