Git Product home page Git Product logo

quarkus-lambda's Introduction

References

The project is based on the tutorials/quickstarts

Modifications done within his project

  • Using Gradle instead of Maven
  • DB migrations instead of programmatic DB setup
  • Added Testcontainers to set up Postgres in unit tests
  • Added several SAM command lines as Gradle tasks

Configuration

  • Required installations
    • AWS CLI
    • AWS SAM CLI
    • Docker
  • Required environment variables configured in AWS for the Lambda
    • QUARKUS_DATASOURCE_USERNAME
    • QUARKUS_DATASOURCE_PASSWORD
    • QUARKUS_DATASOURCE_JDBC_URL
    • QUARKUS_DATASOURCE_REACTIVE_URL
  • Existing .env.json configuration file in the project root directory, see .env.json.template

Lessons learned

Performance

  • The native image uses less memory than the Java 11 runtime, the costs of a 64M memory block could be saved at AWS.
  • The native image has a significantly lower cold start delay, several seconds less than the Java 11 runtime. A cold start delay of one second or less should be achievable.

Current problems

  • The quarkusDev Gradle task and @NativeImageTest are not working since the container tries to reach a nonexistent AWS Lambda poll URL at startup.
  • The startLocally ans startNativeLocally custom Gradle tasks cannot be stopped cleanly by CTRL+C or by IDEA.

Access both RDS and public internet resources from the same Lambda

  • The correct solution
    • Create a new security group for the Lambda and configure access from the RDS security group, as described here.
    • Configure at least one new subnet and enable internet access over a NAT gateway (extra costs), as described here.
    • Configure security group and subnet(s) in a VpcConfig in sam.*.yml. Make sure the Lamba has the AWSLambdaVPCAccessExecutionRole permission.
  • The development solution (since the correct solution requires a NAT gateway which is charged hourly, this contradicts the idea of just testing a Lambda with minimal costs or even within the AWS free tier)
    • Configure the RDS instance as publicly accessible (and implicitly accept the related security risks). By default a Lambda runs in a secure VPC with access to AWS services and the internet (but not internal resources like RDS).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.