Skip to content

Project to demonstrate how to create an endpoint using Amazon Lambda with Java

Notifications You must be signed in to change notification settings

joelscampos/aws-java-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws-java-rest-api

Project to demonstrate how to create an endpoint using Amazon Lambda with Java

Install Pre-requisites

Testing Pre-requisites

Teste Java installation: java -version

    C:\Users\JoelSCampos>java -version
    java version "1.8.0_211"
    Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

Test Mavan installation: mvn -v

C:\Users\JoelSCampos>mvn -v
    Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T16:00:29-03:00)
    Maven home: C:\maven-3.6.1\bin\..
    Java version: 1.8.0_144, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_144\jre
    Default locale: pt_BR, platform encoding: Cp1252
    OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Test Serverless Framework: serverless -version

    C:\Users\JoelSCampos>serverless -version
    1.42.2

Both commands should display the versions of the Java and Maven, respectively.

Create the AWS Serverless Project

Create a new folder for your project:

image

Command to create an AWS Serverless project: image

The above command created these files:

image

In the pom.xml, change value of these two tags:

image

Now, build the Java project:

image

You will notice the java project was built into the "/target/" folder:

image

Now we have to ajuste the file "serverless.yml".

Change the values of these two properties, so the serverless framework will be able to find the "aws-java-rest-project-dev.jar":

image

Now, map an event to an handler:

image image

Now we just have to run the "serverless deploy" command, to see everything goes up to the Amazon servers:

image

And there we have the endpoint working:

image

About

Project to demonstrate how to create an endpoint using Amazon Lambda with Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages