38 lines
1.8 KiB
Markdown
38 lines
1.8 KiB
Markdown
Copied from 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](https://projects.spring.io/spring-framework/). The `StreamLambdaHandler` object is the main entry point for Lambda.
|
|
|
|
The application can be deployed in an AWS account using the [Serverless Application Model](https://github.com/awslabs/serverless-application-model). The `template.yml` file in the root folder contains the application definition.
|
|
|
|
## Pre-requisites
|
|
* [AWS CLI](https://aws.amazon.com/cli/)
|
|
* [SAM CLI](https://github.com/awslabs/aws-sam-cli)
|
|
* [Gradle](https://gradle.org/) or [Maven](https://maven.apache.org/)
|
|
|
|
## 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
|
|
``` |