AWS Lambda: Exposing Java (Corretto) / MicroProfile HTTP / REST Service via Function URL without Gateways or Application Load Balancers with CDK

With Lambda function URLs you can directly expose an AWS Lambda, without REST / HTTP API Gateway or Application Load Balancer.

An AWS Lambda function:

import software.constructs.Construct;

public class QuarkusLambda extends Construct{

    static Map<String, String> configuration = Map.of("message", "hello, quarkus as AWS Lambda");
    static String lambdaHandler = "";
    static int memory = 1024; //~0.5 vCPU
    static int maxConcurrency = 2;
    static int timeout = 10;
    IFunction function;

    public QuarkusLambda(Construct scope,String functionName) {
        super(scope, "QuarkusLambda");
        this.function = createFunction(functionName, lambdaHandler, configuration, memory, maxConcurrency, timeout);

    IFunction createFunction(String functionName,String functionHandler, Map<String,String> configuration, int memory, int maximumConcurrentExecution, int timeout) {
        return Function.Builder.create(this, functionName)

    public IFunction getFunction(){
        return this.function;

Can be directly exposed via a generated URL with:

var quarkuLambda = new QuarkusLambda(this, "airhacks_lambda_gretings_boundary_FUrl");
var function = quarkuLambda.getFunction();
var functionUrl = function
CfnOutput.Builder.create(this, "FunctionURLOutput").value(functionUrl.getUrl()).build();

In this 6 minute screencast I refactored a Lambda from HTTP API Gateway to use Function URL directly:

The example in the screencast is based on the Quarkus / Lambda template:


Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments