Skip to content

tyler2cr/AWS-Lambda-with-Spring-MVC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Spring Boot 2 example

The goal of this sample is to demonstrate the use of the aws-serverless-java-container with Spring MVC

The StreamLambdaHandler object is the main entry point for the Lambda.

The application can be deployed in an AWS account using the Serverless Application Model. The template.yml file in the root folder contains the application definition.

Pre-requisites

Deployment

In a shell, navigate to the root folder of the repository and use the SAM CLI to build a deployable package

$ sam build

This command compiles the application and prepares a deployment package in the .aws-sam sub-directory.

To deploy the application in your AWS account, you can use the SAM CLI's guided deployment process and follow the instructions on the screen

$ sam deploy --guided

Once the deployment is completed, the SAM CLI will print out the stack's outputs, including the new application URL.

...
CloudFormation outputs from deployed stack
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Outputs                                                                                                                                                                                                                                                                                                                                      
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key                 SpringBootPetStoreApi                                                                                                                                                                                                                                                                                                    
Description         URL for application                                                                                                                                                                                                                                                                                                      
Value               https://xxxxxxxxxx.execute-api.us-west-1.amazonaws.com/                                                                                                                                                                                                                                                             
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

You can use curl or a web browser to make a call to the URL. Remember to append the path name: /hello

$ curl https://xxxxxxxxxx.execute-api.us-west-1.amazonaws.com/hello

Cold starts

See also

Wiki - aws-serverless-java-container


This project was initially cloned from
awslabs/aws-serverless-java-container "Serverless Spring Boot 2 example"

Releases

No releases published

Packages

No packages published

Languages