Install graal. This was tested against GraalVM CE 20.3.0
Local Simulated Lambda
-
Build the native image: ./mvnw clean install -Dnative -Dquarkus.native.container-build=true
-
sam local start-api --template target/sam.native.yaml
Steps to deploy to AWS Lambda.
-
Build the native image: ./mvnw clean install -Dnative -Dquarkus.native.container-build=true
-
Login into your AWS account for your cli and make sure you have an s3 bucket you can use for deploy artifacts.
-
Package it for AWS lambda: sam package --template-file target/sam.native.yaml --output-template-file packaged-native.yaml --s3-bucket
-
Deploy it for AWS lambda: sam deploy --template-file packaged-native.yaml --capabilities CAPABILITY_IAM --stack-name
-
Get the URL of the API Gateway exposing your lambda (see outputs): aws cloudformation describe-stacks --stack-name
Hit the URL:
curl -X POST /persons \
-H 'content-type: application/json'
-H 'accept: application/json'
-d '{"person": {"name":"John Quark", "age": 20}}'