Files

Modeled after https://github.com/awslabs/aws-serverless-java-container/tree/main/samples/spring/pet-store

Serverless Spring example

A basic pet store written with the Spring framework.

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 sample's folder 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. You can use curl or a web browser to make a call to the URL

...
---------------------------------------------------------------------------------------------------------
OutputKey-Description                        OutputValue
---------------------------------------------------------------------------------------------------------
PetStoreApi - URL for application            https://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/pets
---------------------------------------------------------------------------------------------------------

$ curl https://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/pets