This example shows how to use JVM-based project powered by Spring Cloud Function framework together with LocalStack.
Application setup:
- HTTP routing and warmups
- Pure lambda functions
- Event handling lambda functions [pro]
Application testing:
- Testing with JUnit and LocalStack Java Utils
- Debugging application with remote debugger
Deployment setup:
- Deploying and hot code swapping with Serverless
- Deploying and hot code swapping with CDK
- Deploying and hot code swapping with Terraform
src/main- project sources directorysrc/test- project tests directorydeployments/cdk- sample CDK deploymentdeployments/serverless- sample Serverless deploymentdeployments/terraform- sample Terraform deployment
- Docker
- Java JDK 11
- [optional] watchman for code hot-swapping
- [optional] Nodejs for Serverless deployments
- [optional] aws cdk and cdklocal for CDK deployments
- [optional] Terraform for terraform deployments
make usage- show usage help
- If you are going to use pro-features, rename
.env.exampleto.envand set your LocalStack pro API Key - Start the LocalStack service
docker compose up [-d] - Deploy the local stack using one of available frameworks
make deploy-<framework>-local, for examplemake deploy-cdk-local - Optionally start the watchman service for code hot-swapping
make watch - Invoke one of the endpoints, or lambda functions
Inspect the Makefile and configuration files to see
implementation details.
- create a new shell target to wait debugger server on port
5050:
while [[ -z $(docker ps | grep :5050) ]]; do sleep 1; done; sleep 1;- Add a new Remote Debugger target to attach to port
5050and select the shell target from above as abefore launchaction - Run the debugger and invoke your lambda function