Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
42 lines (22 loc) · 1008 Bytes

File metadata and controls

42 lines (22 loc) · 1008 Bytes
Copy raw file
Download raw file
Outline
Edit and raw actions

Spring boot with AWS Lambda

Sample application to demonstrate running a Spring Boot application as an AWS Lambda built with Cloud formation.

AWS Lambda

Build the code and deploy with AWS SAM.

mvn clean package

aws cloudformation package --template-file sam.yaml --output-template-file target/output-sam.yaml --s3-bucket lambda-cfn

aws cloudformation deploy --template-file target/output-sam.yaml --stack-name spring-boot-lambda --capabilities CAPABILITY_IAM

aws cloudformation describe-stacks --stack-name spring-boot-lambda

Run

To build and run from a packaged jar locally:

mvn spring-boot:run

or

mvn clean package -Dboot
java -jar target/spring-boot-lambda-1.0.0-SNAPSHOT.jar

Docker

To build the image. First build the application, then build the docker image

mvn package -Dboot
docker build -t spring-boot-lambda .

Run

docker run --name spring-boot-lambda -p 8080:8080 -d spring-boot-lambda

Test

curl http://localhost:8080/languages
Morty Proxy This is a proxified and sanitized view of the page, visit original site.