AWSLambdaWithSpringBoot - No Spring JPA
- Quick Starter Project for those who like to see how Maven + Spring Boot + AWS Lambda + API Gateway works
- As a whole, its a way to try Serverless Architecture using Java
- Java 8 and Maven
- AWS Account
- Clone the Repo
- Use IDE like VSCode or Eclipse. If VSCode, open the workspace file
- Study the code🤷♂️
- Make a maven build using
mvn package
from command line/terminal. JAR file will be created - Open AWS Lambda. Create a function and once created provide the handler name as
com.serverless.rest.restapi.handler.AWSHandler::handleRequest
as shown below. Upload JAR file here. - Do not configure API Gateway from AWS Lambda. Instead Go to API Gateway in AWS. Create a new API.
- You have to create 2 resource and 1 child resource.
/post
,/posts
and{id}
as sub child forposts
. Note the difference between post and posts - Now create methods for these resources POST for
/post
, GET forposts
, PUT and DELETE for{id}
child resource. Configure as shown below. Enter the lambda which you created in function name to link. - Finally it should look something like this
- Deploy API like this. Select any stage name.
- Get the API gateway URL and test using Postman or curl
- This is more like a quick POC. So its not the best way to write code.
- Add tests in real world.
🍻 Write me a quick and simple recommendation for me in linkedin