Example repository for running a SpringBoot API on AWS Lambda. This GitHub repo coincides with a series on Youtube walking through how to build and deploy SpringBoot API's on Lambda.
To deploy this sample into your own AWS account two seperate steps are required. The first is to deploy the infrastructure, the second to deploy the application code.
The infrastructure is built using the AWS CDK. The deployed resources contain:
- A VPC
- 2 private, 2 public subnets
- 2 NAT Gateways
- Postgres RDS Instance
- Secrets Manager secret for credentials
- Lambda function for applying database changes
To deploy the infrastructure, run the following commands in order:
cd infrastructure/db-setup
mvn clean install
cd ../cdk
cdk deploy
This will compile the db-update Lambda function and then deploy the CDK infrastructure to your account. 3 values will output to the console that are required to deploy the application.
The application is deployed using AWS SAM. You can install AWS SAM here. To deploy the application run the below commands:
sam build
sam deploy --guided