Termite. A Java library for the selective “Lambdafication” of applications.

by Serhii Dorodko

Introducing selective Lambdafication

“Lambdafication” is the automated transformation of source code to make it run on AWS Lambda. It is a provider-specific flavour of generic “FaaSification” which is our ultimate research goal. With our Lambdafication tooling, we offer application engineers today the possibility to step into the serverless world without much effort, and leave the more challenging research tasks for the summer time.

Continuing the Java Lambdafication topic, started with the Java translation tool for AWS Lambda called Podilizer, we inform about the open source launch of Termite, a buildtime/runtime library for Lambdafication. And here is logical question: “Why do we need another tool which essentially does the same job as Podilizer?” The reasons come from experience we gained prototyping, developing and field-testing Podilizer. One of them is the quality of translation of some complex projects (Java OOP/functional programming paradigm issues). Another one touches the code design: FaaS does not position itself as a new full cloud deployment method, furthermore native design of serverless fits the idea of going along with other projects and infrastructures. We assume that functions could take care about particular tasks in the cloud or become a glue between existing microservices. Based on this knowledge we created Termite, which tends to fit current FaaS paradigms by letting application engineers choose which methods to export.

Termite vs Podilizer

Unlike Podilizer, which is implemented as command-line tool and unconditionally translates a whole project’s source code, Termite’s design allows to translate certain methods into Lambda functions. It provides syntax elements to mark methods in your project and have them translated and uploaded as lambda functions in a controlled way. Not a less important advantage of Termite is auto-generating dependencies for each function, leading to easier configuration. On the other hand, Podilizer is able to handle between-functions calls, while Termite does not give you such opportunity (yet). Overall Termite looks more harmonious and flexible compare to Podilizer despite the limited maturity.

Architecture and design

The core idea of the design are Java annotations as a syntactical means to mark and configure functions. As long as annotations are part of the language they are easy in understanding and usage. An example for marking a method with annotations follows:


public static int sum(int a1, int a2){

return a1 + a2;


The syntax makes it possible to configure Lambda function aspects such as resource use and placement:

@Lambda(timeOut = 60, memorySize = 512, region="us-west-2")

public static int sum(int a1, int a2){

return a1 + a2;


Annotated methods are being processed over the compilation phase. The Termite processor creates Lambda functions based on the particular method specification and uploads them to the cloud. Function invocation is performed through the AspectJ library. AspectJ interrupts the runtime workflow and calls deployed Lambda functions instead of local methods, as shown in the following high-level diagram.

How to use

Before using Termite directly from our Git repository, make sure to fulfil the following prerequisites:

  • AWS account and credentials configured at your machine (aws command-line tool should work: aws lambda list-functions)
  • JDK 1.8+ installed
  • Maven installed

Clone from https://github.com/serviceprototypinglab/termite (In the folder ‘example’ you can find example project which uses Termite):

clone https://github.com/serviceprototypinglab/termite.git

Compile the project:

cd termite
mvn clean install

Afterwards, Termite is ready to be used within your Java application. Assuming you use Maven, create your own Maven project and configure dependencies. In case you use another build system, Termite does not offer integration yet but we are happy to accept patches of course.


Correct execution is able only with the following argument to the Maven execution plugin:


Also you need the generic Maven plugin for compiling generated sources because Termite will generate some source code files:


A full example of a Maven configuration file is located in the Termite repository at


Afterwards, you’re ready to go serverless! Annotate functions you want to upload with “@Lambda”, see the example above.

Compile the created project:

mvn clean install

Maven will inform you about deployed functions which are then ready to be used from AWS Lambda. We’d like to hear from your experience with using Termite – do not hesitate to comment on this post.


  1. Thanx for the great article…
    Its very basic.. its help me a lot..
    but i want to ask you about Polymorphism..
    did you have an article about it??

  2. Is this concept is new in java or what. Because i heard frist time about this.
    Graet that i find this article.

  3. Write is easyily understandable.
    Thanks for the sharing

  4. With our Lambdafication tooling, It offer application engineers today the possibility to step into the serverless world without much effort.

  5. Java methods are often stateful through instance attributes. The state handling of the resulting decomposed functions can either extend the method signature to pass in and out all attributes which are accessed and modified, or use server-side state. AWS Lambda offers both an S3 blob storage interface and local environment variables. However, the variables are restricted to read-only access from the runtime

  6. Wonderful article for the deatil understanding.
    Looking forward to see the next post.

  7. Looking great work! I really appreciated to you on this quality work. The article contains detailed information about selective Lambdafication and for me it’s really easy to understand. Thanks for sharing this concept. keep up the great work!

  8. Wonderful Article.
    looking forward to what’s in store next

Leave a Reply

Your email address will not be published. Required fields are marked *