Java Lambda support comes to AWS
Great news for Java aficionados – Amazon Web Services are now welcoming Java Lambdas into their programming model. Amazon are also planning on expanding their language options, with added features to Lambda support on the horizon.
Lambda functions in Java are now a reality for users of Amazon Web Services, with support being announced by AWS chief evangelist Jeff Barr. Citing their internal mailing list and their customers’ love of Lambda, Barr declared the functionality was made available by popular request.
Since launching AWS Lambda functions in 2014, the expansion to Java enables users to make use of JDK 8 features on top of the Java libraries of their choosing. The AWS SDK for Java is the place to go to make calls to the AWS APIs.
Part of that package includes two added libraries:
aws-lambda-java-core contains interfaces for Lambda function handlers and the context object and
aws-lambda-java-events is for prepackaged type definitions for AWS event sources, such as DynamoDB, Kinesis and Cognito.
To write up your Lambda functions, Barr presents two options. The first uses input and output objects as below:
public lambdaHandler( input, Context context) throws IOException; public lambdaHandler( input) throws IOException;
The second option, for those that don’t want to go down the serialisation model route, is more low-level:
public void lambdaHandler(InputStream input, OutputStream output, Context context) throws IOException;
Barr reassures users that their existing development tools will suffice for utilising Java support, with ZIP or JAR files to be created in order to prepare your compiled code for use. These must contain the required CLASS files and any JAR files you need, remembering that deployment packages uploaded to Lambda are limited to 50 MB.
An AWS Toolkit for Eclipse has been made available too, and the plugin will automatically generate and upload the ZIP file for you. With all this extra functionality and more language options planned for AWS, the Amazon cloud is looking a little more attractive to some developers.
More information about authoring Lambda functions in Java can be found in the correlating documentation. Lambda support in Java is available to tap into immediately.