{"id":103049,"date":"2020-03-26T10:00:21","date_gmt":"2020-03-26T08:00:21","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=103049"},"modified":"2020-03-23T15:26:28","modified_gmt":"2020-03-23T13:26:28","slug":"how-to-create-aws-lambda-function-with-java","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html","title":{"rendered":"How to create AWS Lambda function with Java"},"content":{"rendered":"<p>In this tutorial, we will see how we can create AWS Lambda function in Java and I tell you, it is quite easy to do so&#8230;<\/p>\n<p>Basically, there are three ways in which we can create AWS Lambda function :<\/p>\n<p>&#8211; By implementing RequestHandler interface<\/p>\n<p>&#8211; By implementing RequestStreamHandler interface<\/p>\n<p>&#8211; Custom implementation, which does not require us to implement any AWS specific interface<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"320\" height=\"199\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.46.25.png\" alt=\"\" class=\"wp-image-103080\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.46.25.png 320w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.46.25-300x187.png 300w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\"><b>AWS Lambda function by implementing RequestHandler interface<\/b><\/h2>\n<p>For using this method of creating AWS lambda function, we need to have following dependency in our project :<\/p>\n<pre class=\"brush:xml\">\n&lt;dependency&gt;\n &lt;groupId&gt;com.amazonaws&lt;\/groupId&gt;\n &lt;artifactId&gt;aws-lambda-java-core&lt;\/artifactId&gt;\n &lt;version&gt;1.1.0&lt;\/version&gt;\n\n&lt;\/dependency&gt;\n<\/pre>\n<p>And below is how your class will look like :<\/p>\n<pre class=\"brush:java\">\npackage com.blogspot.javasolutionsguide;\n\nimport com.amazonaws.services.lambda.runtime.Context;\nimport com.amazonaws.services.lambda.runtime.RequestHandler;\n\npublic class HelloWorldWithRequestHandler implements RequestHandler<Object,Object> {\n\n @Override\n public Object handleRequest(Object input, Context context) {\n  return String.format(\"Hello %s%s.\", input ,\" from \" + context.getFunctionName());\n }\n} \n<\/pre>\n<p>Once you have created maven project with above dependency and class in your project, maven build the project, which will create jar for you in the target folder of your project.<\/p>\n<p>Now open the AWS Console, go to Services and search for AWS Lambda.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"320\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.27.10.png\" alt=\"\" class=\"wp-image-103082\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.27.10.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.27.10-300x150.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>On the following screen ,click on Create Function.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"78\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.27.29.png\" alt=\"\" class=\"wp-image-103083\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.27.29.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.27.29-300x37.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>On following screen, enter Function name &#8220;HelloWorld&#8221; and choose Runtime as Java 11.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"282\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.43.37.png\" alt=\"\" class=\"wp-image-103084\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.43.37.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.43.37-300x132.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>In Permissions section, choose &#8220;Create a new role with basic Lambda permissions&#8221;and AWS Lambda will create and execution role with name HelloWorld-role-jc6cmpnj. This role is required to allow AWS Lambda to upload logs to AWS Cloudwatch logs.<\/p>\n<p>Click on Create Function.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"322\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.43.49.png\" alt=\"\" class=\"wp-image-103087\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.43.49.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-22.43.49-300x151.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>You will see following screen, where it says that &#8220;Successfully created the function HelloWorld.You can now change its code and configuration.To invoke your function with a test event, choose Test&#8221;.<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"640\" height=\"300\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.00.01.png\" alt=\"\" class=\"wp-image-103085\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.00.01.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.00.01-300x141.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"247\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.01.20.png\" alt=\"\" class=\"wp-image-103086\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.01.20.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.01.20-300x116.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>Now in the Function code section, click on the upload button and browse on your computer for the jar that you created earlier.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>&#8211; Also, in the Handler textbox, replace<br \/><b>example<\/b> with package name where your &#8220;HelloWorldWithRequestHandler&#8221; class is residing, which in our case it is &#8220;<br \/><b>com.blogspot.javasolutionsguide<\/b>&#8220;<\/p>\n<p>&#8211; And replace Hello with &#8220;HelloWorldWithRequestHandler&#8221;.<\/p>\n<p>&#8211; And replace handleRequest will stays as is ,because we also have same method name in our class.<\/p>\n<p>Click on Save button on extreme right side of the screen.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"320\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.10.10.png\" alt=\"\" class=\"wp-image-103088\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.10.10.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.10.10-300x150.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>Now to test our lambda function, we need to configure test event(s),for which we will click on &#8220;Select a Test event&#8221; drop down and then click on &#8220;Configure test events&#8221;.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"74\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.12.38.png\" alt=\"\" class=\"wp-image-103089\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.12.38.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.12.38-300x35.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>You will see following screen.Enter Event name as &#8220;HelloWorldEvents&#8221; and replace following<\/p>\n<p>{<\/p>\n<p>&nbsp; &#8220;key1&#8221;: &#8220;value1&#8221;,<\/p>\n<p>&nbsp; &#8220;key2&#8221;: &#8220;value2&#8221;,<\/p>\n<p>&nbsp; &#8220;key3&#8221;: &#8220;value3&#8221;<\/p>\n<p>}<\/p>\n<p>with just your name like as below :<\/p>\n<p>&#8220;Gaurav Bhardwaj&#8221;<\/p>\n<p>and click on Create button.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"607\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.17.46.png\" alt=\"\" class=\"wp-image-103090\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.17.46.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.17.46-300x285.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>Now click on Test button and you should see your lambda function executed successfully with message &#8220;Hello Gaurav Bhardwaj from HelloWorld&#8221;,which is the output returned by our lambda function.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"323\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.18.57.png\" alt=\"\" class=\"wp-image-103091\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.18.57.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.18.57-300x151.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>If you click on the logs link in the above screen, it will take you to the AWS Cloudwatch screen where you can see that for your lambda function a LogGroup has been created and under which you have LogStream where you can see logs of your lambda function.This was the reason we assigned role to our lambda function, because AWS lambda used that role to push logs to the Cloudwatch.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"640\" height=\"297\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.23.14.png\" alt=\"\" class=\"wp-image-103092\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.23.14.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/03\/Screenshot-2020-03-21-at-23.23.14-300x139.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\"><b>AWS Lambda function by implementing RequestStreamHandler interface<\/b><\/h2>\n<p>In this case you need to follow exact same steps as in above case.It is just that in the code you need to implement RequestStreamHandler interface rather than RequestHandler interface as below.<\/p>\n<pre class=\"brush:java\">\npackage com.blogspot.javasolutionsguide;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\n\nimport com.amazonaws.services.lambda.runtime.Context;\nimport com.amazonaws.services.lambda.runtime.RequestStreamHandler;\n\npublic class HelloWorldWithRequestStreamHandler implements RequestStreamHandler {\n\n @Override\n public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {\n  int letter;\n        while((letter = inputStream.read()) != -1)\n        {\n            outputStream.write(Character.toUpperCase(letter));\n        }\n }\n}\n<\/pre>\n<h2 class=\"wp-block-heading\">AWS Lambda function by custom implementation, which does not require us to implement any AWS specific interface<\/h2>\n<p>You can also have your custom lambda function ,which does not follow signature from some AWS specific interface.You can even omit Context object as well, if you don&#8217;t want it.<\/p>\n<p>In the following code,I have tried to put two handler methods, one with Context object and one without Context object.To test these both ,you just need to change the name of the method in the AWS console and it will start hitting that method.<\/p>\n<p>Also ,we can see that from Context object ,we can get lots of useful information like name of AWS fucnton,its version,ARN,how much memory is allocated to the function(by default it is 512 mb) .<\/p>\n<pre class=\"brush:java\">\npackage com.blogspot.javasolutionsguide;\n\nimport com.amazonaws.services.lambda.runtime.Context;\n\npublic class HelloWorld {\n \n        \/\/Handler method without Context\n public String sayHelloWorldWithoutContext(String name) {\n  return String.format(\"Hello %s.\", name);\n }\n \n \/\/We need to add aws-lambda-java-core dependency if we add Context as parameter.\n public String sayHelloWorldWithContext(String name, Context context) {\n  \n  context.getLogger().log(\"Lambda Function Name:\" + context.getFunctionName() +\n    \"Version:\" + context.getFunctionVersion() + \n    \"Arn:\" + context.getInvokedFunctionArn() +\n    \"Allocated Memory:\" + context.getMemoryLimitInMB() +\n    \"Remaining Time:\"+ context.getRemainingTimeInMillis());\n  return String.format(\"Hello %s.\", name);\n }\n\n}\n<\/pre>\n<p>Also in the following example ,we can see that if we have two handler methods with same name in our class,the handler method which has Context object as its last parameter will be called.<\/p>\n<pre class=\"brush:java\">\npackage com.blogspot.javasolutionsguide;\n\nimport com.amazonaws.services.lambda.runtime.Context;\n\npublic class HelloWorldWithMultipleHandlersWithSameName {\n \n public String handler(String name) {\n  return String.format(\"Hello %s.\", name);\n }\n \n public String handler(String name, Context context) {\n  \n  return String.format(\"Hello %s%s.\", name,   \" Memory Allocated:\" + context.getMemoryLimitInMB());\n }\n\n}\n<\/pre>\n<h3 class=\"wp-block-heading\">You can find all code of this tutorial in&nbsp;<a href=\"https:\/\/github.com\/gauravbhrdwj\/javaSolutionsGuide\/\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub<\/a><\/h3>\n<h2 class=\"wp-block-heading\"><b>Summary :<\/b><\/h2>\n<p>&#8211; So, we saw how can create AWS lambda function in various ways in Java.<\/p>\n<p>&#8211; Name of the handler method does not matter.You can choose any name of your choice.<\/p>\n<p>&#8211; If you have two handler methods with same name in your class, the handler method which has Context object as its last parameter will be called.<\/p>\n<p>&#8211; The first parameter of the handler method is the input to the handler, which can be&nbsp;<\/p>\n<p>&nbsp; &nbsp;&#8211; Event data published by an event source like S3 in the form of predefined AWS event types like S3Event.<\/p>\n<p>&nbsp; &nbsp;&#8211; Custom input (Primitive or Object type).<\/p>\n<p>&#8211; In order for AWS lambda to successfully invoke the handler method, the function must be invoked&nbsp; &nbsp; &nbsp;with input data that can be serialized into the data type of the input parameter.<\/p>\n<p>&#8211; If you are invoking your lambda function synchronously(Invoke type RequestResponse), then you can return any allowed primitive or Object type from your handler, however if you are invoking your lambda function asynchronously(Invoke type Event), then return type of your handler must be void.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>\n<p>Published on Java Code Geeks with permission by Gaurav Bhardwaj, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/javasolutionsguide.blogspot.com\/2020\/03\/how-to-create-aws-lambda-function-with.html\" target=\"_blank\" rel=\"noopener noreferrer\">How to create AWS Lambda function with Java<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will see how we can create AWS Lambda function in Java and I tell you, it is quite easy to do so&#8230; Basically, there are three ways in which we can create AWS Lambda function : &#8211; By implementing RequestHandler interface &#8211; By implementing RequestStreamHandler interface &#8211; Custom implementation, which does &hellip;<\/p>\n","protected":false},"author":955,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[1669],"class_list":["post-103049","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-aws-lambda"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to create AWS Lambda function with Java - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about AWS Lambda? Check our article explaining how to create AWS Lambda function with Java with examples\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create AWS Lambda function with Java - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about AWS Lambda? Check our article explaining how to create AWS Lambda function with Java with examples\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-26T08:00:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Gaurav Bhardwaj\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gaurav Bhardwaj\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html\"},\"author\":{\"name\":\"Gaurav Bhardwaj\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/58bd3e1f6edc1bed6a6374fe9a34ca37\"},\"headline\":\"How to create AWS Lambda function with Java\",\"datePublished\":\"2020-03-26T08:00:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html\"},\"wordCount\":944,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"AWS lambda\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html\",\"name\":\"How to create AWS Lambda function with Java - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2020-03-26T08:00:21+00:00\",\"description\":\"Interested to learn about AWS Lambda? Check our article explaining how to create AWS Lambda function with Java with examples\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/03\\\/how-to-create-aws-lambda-function-with-java.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to create AWS Lambda function with Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/58bd3e1f6edc1bed6a6374fe9a34ca37\",\"name\":\"Gaurav Bhardwaj\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"caption\":\"Gaurav Bhardwaj\"},\"description\":\"Gaurav has done Masters in Computer Applications(MCA) and is working in Software development field for more than 10 years in Java\\\/J2EE technologies. He is currently working with one of top MNC. He has worked on various frameworks like Struts, Spring, Spring Boot, Angular JS, JSF, Velocity, iBatis, MyBatis, Hibernate, JUnit, Mockito, Dozzer. He likes to explore new technologies and share his thoughts by writing a technical blog. He is the founder of JavaSolutionsGuide.blogspot.com.\",\"sameAs\":[\"http:\\\/\\\/www.javasolutionsguide.blogspot.nl\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/gaurav-bhardwaj\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create AWS Lambda function with Java - Java Code Geeks","description":"Interested to learn about AWS Lambda? Check our article explaining how to create AWS Lambda function with Java with examples","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html","og_locale":"en_US","og_type":"article","og_title":"How to create AWS Lambda function with Java - Java Code Geeks","og_description":"Interested to learn about AWS Lambda? Check our article explaining how to create AWS Lambda function with Java with examples","og_url":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-03-26T08:00:21+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Gaurav Bhardwaj","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Gaurav Bhardwaj","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html"},"author":{"name":"Gaurav Bhardwaj","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/58bd3e1f6edc1bed6a6374fe9a34ca37"},"headline":"How to create AWS Lambda function with Java","datePublished":"2020-03-26T08:00:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html"},"wordCount":944,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["AWS lambda"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html","url":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html","name":"How to create AWS Lambda function with Java - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2020-03-26T08:00:21+00:00","description":"Interested to learn about AWS Lambda? Check our article explaining how to create AWS Lambda function with Java with examples","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2020\/03\/how-to-create-aws-lambda-function-with-java.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"How to create AWS Lambda function with Java"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/58bd3e1f6edc1bed6a6374fe9a34ca37","name":"Gaurav Bhardwaj","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","caption":"Gaurav Bhardwaj"},"description":"Gaurav has done Masters in Computer Applications(MCA) and is working in Software development field for more than 10 years in Java\/J2EE technologies. He is currently working with one of top MNC. He has worked on various frameworks like Struts, Spring, Spring Boot, Angular JS, JSF, Velocity, iBatis, MyBatis, Hibernate, JUnit, Mockito, Dozzer. He likes to explore new technologies and share his thoughts by writing a technical blog. He is the founder of JavaSolutionsGuide.blogspot.com.","sameAs":["http:\/\/www.javasolutionsguide.blogspot.nl\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/gaurav-bhardwaj"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/103049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/955"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=103049"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/103049\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=103049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=103049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=103049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}