Getting started with Java Serverless Functions using Quarkus and AWS Lambda

Getting started with Java Serverless Functions using Quarkus and AWS Lambda

Getting started with Java Serverless Functions using Quarkus and AWS Lambda. The serverless journey started with functions - small snippets of code running on-demand and a short period in Figure 1. AWS Lambda in the “1.0” phase made this paradigm very popular.

Java serverless functions with Quarkus

The serverless journey started with functions - small snippets of code running on-demand and a short period in Figure 1.  AWS Lambda in the “1.0” phase made this paradigm very popular, but it had its limitations around execution time, protocols, and poor local development experience. 

Since then, developers realized that the same serverless traits and benefits could be applied to microservices and Linux containers. This leads us into what we're calling the “1.5” phase in Figure 1. Some serverless containers here completely abstract  Kubernetes, delivering the serverless experience through an abstraction layer that sits on top of it, like  Knative.

When we achieve this "2.0" phase in Figure 1, the serverless becomes to handle more complex orchestration and integration patterns, combined with some level of state management. More importantly, developers desire to keep using a familiar application runtime, Java, to run a combination of serverless and non-serverless workloads in legacy systems. 

Figure 1. Serverless Journey

So what is the first task for Java developers before they get started with developing new serverless functions along with this journey? That should be to choose a new cloud-native Java framework that allows developers to run Java functions quicker and smaller memory footprint than traditional monolithic applications. This capability can also be applied to various infrastructure environments from physical servers to virtual machines, and containers in multi and hybrid cloud.

Developers might think of an opinionated  Spring framework that uses java.util.function package in  Spring Cloud Function to support imperative and reactive functions development. Spring also enables the developers to deploy Java functions to common Function as a Service (FaaS) services such as  Amazon Lambda,  Apache OpenWhisk,  Microsoft Azure, and  Project Riff using cloud adaptors. However, the developers still have concerns about slow startup and response time, and heavy memory consuming processes with Spring characteristics. This problem can be worse for running Java functions on scalable container environments like Kubernetes.

To solve this problem, I’d like to bring up a new open source cloud-native Java framework,  Quarkus that aims to design serverless applications and write cloud-native microservices to run on cloud infrastructures Kubernetes and  Red Hat OpenShift Container Platform. 

Quarkus rethinks Java and uses a closed world approach to building and running it and has turned Java into a runtime that’s comparable to Go. Quarkus also includes 100+ extensions for developers to integrate enterprise capabilities from database access to serverless integration, messaging, security, observability, and business automation.

Here is a quick example of how developers can scaffold a Java serverless function project with Quarkus.

1. Creating the Quarkus AWS Lambda maven project 

2. Building Serverless Functions

3. Deploying the Functions to AWS Lambda

4. Testing the Functions on AWS Lambda

java aws serverless microservice lambda quarkus

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Serverless Search for My Blog With Java, Quarkus & AWS Lambda

Essentially, it cost me nothing. This is possible because I chose a serverless implementation approach for this. This is running on AWS Lambda, using their serverless blog search Serverless Search for My Blog With Java, Quarkus & AWS Lambda. How you can implement serverless applications using Quarkus, Java.

AWS Lambda Errors With Java Lambdas and Serverless Framework

In this lesson, we are going to learn how to AWS Lambda Errors with Java Lambdas and Serverless Framework. Why Java lambda expressions give AWS Lambda and Serverless framework a hard time, as well as how to fix the problem.

Create a String Reversal Microservice on AWS Lambda Using Java

There is no better way to explain the function (pun unintended) of complicated cloud services than walking through a step-by-step code…

Serverless Express – Easy APIs On AWS Lambda & AWS HTTP API

Serverless Express enables you to easily host Express.js APIs on AWS Lambda and AWS HTTP API. Here is how to get started and deliver a Serverless Express.js based API with a custom domain, free SSL certificate and much more!

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).