Jeff Barr, Amazon’s CEO, stated that “you will soon have the ability to write your Lambda function in Java!” He announced that the event-driven cloud computing service had been made available to production and was now in preview.
Yesterday, he declared that “soon”, is “now.”
Barr, the evangelist for Amazon Web Services Inc. (AWS), stated in a blog post that “Today we are making Lambda more useful by giving your Lambda function in Java” “We’ve received many requests for this feature and the team is delighted to be able respond.”
Functions for Lambda, which was launched as a preview last November, were previously written in Node.js. This JavaScript framework is designed for back-end, server side work.
Lambda functions are event-driven, making them an ideal fit for mobile back-end systems as well as supporting infrastructure for Web and Internet of Things (IoT). The Lambda page on AWS states that once you have created your Lambda function, it is ready to run whenever it is triggered. This is similar to a formula in spreadsheets. “Each function contains your code and some configuration information including the function name, resource requirements, and function name.”
The Lambda code may be associated with AWS resources such as storage, database or data processing stream. This allows you to respond to different events such as an image upload to storage (S3), an incoming Amazon Kinesis stream, or an update to an Amazon DynamoDB Table.
[Click on the image to see a larger view.] Authoring a Lambda Function. Source: AWS. “AWS Lambda typically executes your code within milliseconds after an event,” AWS stated. The service automatically manages your compute capacity and spins up the infrastructure to deploy your code. It then runs the code for each event. Each event is handled individually, so thousands of functions can be run simultaneously and performance remains consistent regardless of how frequent they occur.
Java 8, which was introduced last year, can be used by developers. It also includes all the Java libraries and the AWS SDK. AWS provides two libraries for Lambda, aws-lambda-java-core for function handlers and a context object, and aws-lambda-java-events for event source type definitions. You can use the AWS Toolkit to Eclipse to generate ZIP files of compiled codes and any required JAR files. AWS provides guidance on how to use the Java deployment tools Maven, Gradle and Gradle.
A Lambda FAQ states that your build process should be the same as the one used to compile Java code that relies on the AWS SDK. Run your Java compiler tool on the source files. Include the AWS SDK version 1.9 or later with transitive dependency on your classpath. Additional guidance is available for Authoring Lambda Functions with Java. Barr also gave details on the two possible approaches to authoring Lambda function, either using a stream-based low-level model or a higher level model that leverages “plain old Java objects” (or Java primitives) for the input and output objects.
Barr stated that support for programming languages other than English is possible.
Developers are charged for the number and time spent on code execution in the Lambda pay as you go pricing model. A free tier provides 1 million monthly requests and 400,000 “GB seconds” of compute time per month.
Categories
AWS Lambda Functions Now Opened up to Java
