• home
  • about
  • contact
  • More
    • home
    • about
    • contact
  • home
  • about
  • contact

AWS Lambda

AWS Lambda is a serverless computing service provided by Amazon to reduce the configuration of servers, OS.


It lets you run code without provisioning or managing servers -  scales automatically and only charges for the time your code is running.

Overview

  • Zero server management
  • Flexible scaling
  • No payment for idle time - Pricing is pay for what you use.

Feat

  • AWS Lambda uses json (Javascript object notation) to pass data to and from lambda functions.


  • We can control the resources(cpu clock, etc) a lambda function on aws can use by assigning it more or less memory. There is no other way to control the amount of resources a lambda function uses. 


  • The input classes in a Lambda function should be Serializable:-


  • e.g. in the code shown, ‘Integer’ is the input class and should be Serializable.

Create a simple Serverless Lambda application using Java

Generate FAT jar

Run 'mvn clean package' to generate the FAT jar file

 Terminal > mvn clean package 

Create a Serverless function on AWS

Run 'mvn clean package' to generate the FAT jar file

 Terminal > mvn clean package 

Upload the fat jar file

 Terminal > mvn clean package 

Configuration

EmployeeFindByIdHandler.java

EmployeeFindByIdHandler.java

EmployeeFindByIdHandler.java

BookAddLambdaHandler.java

EmployeeFindByIdHandler.java

EmployeeFindByIdHandler.java

BookAllLambdaHandler.java

BookAllLambdaHandler.java

BookAllLambdaHandler.java

Note

BookAllLambdaHandler.java

BookAllLambdaHandler.java

  

The handler is specified in the following format:-

package.className::methodName

e.g. com.ankur.lambda.book.BookAllLambda::handleReqeust

Create a Test event - for EmployeeFindByIdHandler

Create a Test event - for BookAddLambdaHandler

Create a Test event - for BookAllLambdaHandler

Create a REST API trigger with API Gateway

Show More

Resources

https://github.com/ankur-israni/simple_lambda_function


simple_lambda_function (zip)Download
  • home
  • about
  • contact

This website uses cookies.

We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.

Accept