项目作者: rjozefowicz

项目描述 :
AWS Lambda custom runtime with GraalVM native-image binary
高级语言: Java
项目地址: git://github.com/rjozefowicz/aws-lambda-graalvm-runtime.git
创建时间: 2020-02-26T20:08:25Z
项目社区:https://github.com/rjozefowicz/aws-lambda-graalvm-runtime

开源协议:MIT License

下载


aws-lambda-graalvm-runtime

AWS Lambda custom runtime with GraalVM native-image binary

Prerequisites

AWS Lambda custom runtime uses Amazon Linux 2 so in order to build native binary it has to be done on that OS e.g. on EC2 instance.

Set up JAVA_HOME environment variable to point GraalVM 19.3+ location e.g.

  1. export JAVA_HOME=/home/ec2-user/graalvm-ce-java11-19.3.1

Create AWS Lambda function with custom runtime. Add IAM role with DynamoDB access and create table with primary key uuid as string type. Add AWS Lambda environment variable TABLE_NAME with table name

This example uses official AWS SDK v2 for Java to access DynamoDB table.

Custom runtime

Custom runtime is implemented according to https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html

Native-image

Most of AWS services require HTTPS communication with their endpoints. In order to make it work with native binares generated by native-image libsunec.so and cacerts are added to custom runtime archive. More details https://quarkus.io/guides/native-and-ssl#the-sunec-library-and-friends

Usage

  1. ./buildAndDeploy.sh FUNCTION_NAME