Story image

How AWS Lambda enables sharing common code between functions

03 Dec 18

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.

HTC signs with 5G partners across the globe
Sprint and Telstra will both carry a 5G mobile smart hub built by HTC.
Dell EMC embeds security in latest servers
Dell EMC's 14th generation of PowerEdge servers has comprehensive management tools to provide security across hardware and firmware.
Soul Machines' virtual humans go mainstream
An Auckland AI firm renowned for its work creating ‘digital humans’ is now unleashing its creativity to the wider market.
Why data backups should be a part of daily operations
"Disaster recovery needs to address complete system failure and provide a set of security policies to govern disaster incidents."
Hands-on review: The Logitech R500 laser presentation remote
With a clever ergonomic design, you’ll never have to glance at the device, unless you deliberately look to use the built-in laser pointer to emphasise your presentation.
Businesses focusing on threats from within - survey
Over 50% of respondents reported that 100 days of dwell time or more was representative of their organisation.
GCSB welcomes Inspector-General's report on intelligence warrants
Intelligence warrants can include surveillance, private communications interception, searches of physical places and things, and the seizure of communications, information and things.
Corelight and Exabeam partner to improve network monitoring
The combination of lateral movement and siloed usage of point security products leaves many security teams vulnerable to compromise.