AWS Lambda
Developer Guide

Programming Model for Authoring Lambda Functions in Java

The following sections explain how common programming patterns and core concepts apply when authoring Lambda function code in Java.

Additionally, note that AWS Lambda provides the following libraries:

  • aws-lambda-java-core – This library provides the Context object, RequestStreamHandler, and the RequestHandler interfaces. The Context object (The Context Object (Java)) provides runtime information about your Lambda function. The predefined interfaces provide one way of defining your Lambda function handler. For more information, see Leveraging Predefined Interfaces for Creating Handler (Java).

  • aws-lambda-java-events – This library provides predefined types that you can use when writing Lambda functions to process events published by Amazon S3, Amazon Kinesis, Amazon SNS, and Amazon Cognito. These classes help you process the event without having to write your own custom serialization logic.

  • Custom Appender for Log4j 1.2 – You can use the custom Log4j (see Apache log4j) appender provided by AWS Lambda for logging from your lambda functions. For more information, see Logging (Java).

These libraries are available through the Maven Central Repository and can also be found on GitHub.