Disclaimer - This project should be considered a POC and has not been tested or verified for production use. If you decided to run this on production systems you do so at your own risk.
Make sure you have the following installed on your build machine before getting started.
- GraalVM
- AWS CLI
$ ./mvnw package
If your system cannot build working images (say to mismatch of library versions), you can build under docker.
docker run --rm -it -v $(pwd):/work oracle/graalvm-ce:19.1.0 \
/bin/bash -c "gu install native-image && cd /work && ./mvnw package"
aws iam create-role \
--role-name lambda-role \
--path "/service-role/" \
--assume-role-policy-document file:///tmp/trust-policy.json
Where the file /tmp/trust-policy.json contains:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}aws lambda delete-function --function-name vertxNativeTester
aws lambda create-function --function-name vertxNativeTester \
--zip-file fileb://target/lambda-0.0.1-SNAPSHOT-function.zip --handler lambda.ApplicationLoadBalancerLambda --runtime provided \
--role arn:aws:iam::985727241951:role/service-role/lambda-role
aws lambda invoke --function-name vertxNativeTester --payload '{"message":"Hello World"}' --log-type Tail response.txt | grep "LogResult"| awk -F'"' '{print $4}' | base64 --decode