aws-lambda-spring-cloud-function-reactive-java
Demo application to test Reactive Spring Cloud Functions on AWS Lambdas using a native runtime.
Requirements:
- Docker
- Java +17 GraalVM
- SAM
Building the native AWS Lambda artifact with SAM
Linux:
sam build
macOS:
AWS Lambda requires native applications to be built in an Amazon Linux compatible OS, so on macOS we need to run the build in a compatible Docker container.
-
Build the Docker image compatible with AWS Linux:
./aws-image/build-aws-image.sh
-
Run
sam build
specifying the Docker image:sam build --use-container --build-image tech.aaregall.lab/amazonlinux-graalvm:latest
Deploy the application as an AWS Lambda using SAM
Define the following environment variables on the deployment host.
export AWS_REGION=...
Deploy the Lambda application
sam deploy --region $AWS_REGION
See CloudWatch logs
sam logs -n SpringCloudFunctionLambda --stack-name aws-lambda-spring-cloud-function-reactive-java
Delete the Lambda application
sam delete SpringCloudFunctionLambda