Here we provide the function configuration.

Name : This should be unique across all the lambda’s defined within your account.

Description : Any description of the lambda function

Runtime: which runtime engine is to be used. here we are going with java 8

Next we upload the lambda code packaged as jar or zip. For now assume that the lambda is already written and is packaged as jar. Here I have uploaded the same under function package.

Next is the actual configuration which is used to actually invoke the function.

Handler: Full name along with the package name, as in below format

<package name>.<class name>::<function name>

Name here used as

Role: I have already created a role, which we will look into it later, mentioned as lambda_basic_execution.

Next we provide the environment details like memory required per lambda execution and the timeout which specifies what is the max execution time of the lambda after it gets timeout with an error. We will look into this later.

For now we are not running this in any VPC.

Once the function is uploaded, click to test the function.

Here we select the sample event template and provide the input data to the function and click Save and Test

Once clicked the respective lambda is called with the above input and the output is returned as shown in the result.

Lambda Code

There are couple of ways to define the handler and here we used RequestHandler<X,Y> interface.

// [1]
public class HelloWorld implements RequestHandler<Request, Response>{

    // [2]
    public Response handleRequest(Request request, Context context) {

        // [3]
        LambdaLogger logger = context.getLogger();

        String result = "Hello world !! " + request.getFirstName();

        // [4]

        // [5]
        Response res = new Response();

        return res;


The mapping classes are Request and Response where the attributes are the input and output values, which are mentioned below.

Lambda will deserialize the input json value to Request bean and the similarly will serialize the output json value back.

[3] & [4]: Context reference is provided by the Lambda environment where we could access information related to environment and other things like logger etc.

public class Request {
    String firstName;
    String lastName;

    public String getFirstName() {
        return firstName;

    public void setFirstName(String firstName) {
        this.firstName = firstName;

    public String getLastName() {
        return lastName;

    public void setLastName(String lastName) {
        this.lastName = lastName;

    public Request(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;

    public Request() {

public class Response {
    String greetings;

    public String getGreetings() {
        return greetings;

    public void setGreetings(String greetings) {
        this.greetings = greetings;

    public Response(String greetings) {
        this.greetings = greetings;

    public Response() {


Below is the required plugin to generate an uber jar comprising of all the required dependency jars if any.


Download Source Code Browse Source Code