Free course · 14 lessons · Intermediate

Java Serverless on AWS Lambda

Run production Java on AWS Lambda through real failures: event deserialization, where JVM cold-start time goes, SnapStart uniqueness and priming, lean packaging, Spring Boot on Lambda, GraalVM native images with Quarkus or Micronaut, API Gateway payload formats and binary bodies, AWS SDK for Java v2 clients, retry multiplication, heap and garbage collection, concurrency and virtual threads, and testing. Every lesson has a Java simulation; shared serverless architecture topics link to the Node.js course.

Start the course

1. Java on Lambda: Runtime Fundamentals

Handlers and serialization, where JVM cold-start time goes, SnapStart, and packaging.

  1. Handlers, Event Types and Serialization — Why a Java handler receives objects full of nulls, and how to model Lambda events correctly.
  2. JVM Cold Starts: Where the Time Goes — Why a simple Java function takes four seconds on its first request, and which levers actually shorten it.
  3. SnapStart, Uniqueness and Priming — How enabling SnapStart made every environment generate the same 'random' IDs, and how to use snapshots safely.
  4. Packaging: Uber-JARs, Dependencies and Size — Why a Java function's artifact grows past Lambda's size limit, and how to package lean JARs.

2. Frameworks, Native Images and SDK Clients

Spring Boot on Lambda, GraalVM native images, API event shapes, and configuring the AWS SDK for Java v2.

  1. Spring Boot on Lambda — Why a Spring Boot function takes eight seconds to start, and the options for running Spring well on Lambda.
  2. GraalVM Native Images with Quarkus or Micronaut — When compiling Java ahead of time is worth it on Lambda, and the reflection pitfalls that break native builds.
  3. API Gateway Events and Response Shapes in Java — Why a Java API returns 500 after switching from a REST API to an HTTP API, and how to handle event formats and binary bodies.
  4. AWS SDK for Java v2: Clients, HTTP and Retries — Why creating SDK clients per request makes a Java function slow and leaky, and how to configure clients for Lambda.

3. Running Java Functions in Production

Logging, tracing and retries, heap and garbage collection, concurrency inside a function, and testing.

  1. Logging, Tracing and Retries — Why a Java function's logs are unsearchable and a partner outage produced 27x more calls, and how to fix both.
  2. Memory, Heap and Garbage Collection — Why a Java function is OOM-killed while the heap looks half empty, and how to size memory for the JVM on Lambda.
  3. Concurrency Inside a Java Function — Why thread pools created per invocation leak threads and memory, and how to fan out I/O safely, including with virtual threads.
  4. Testing Java Functions — Why handler code that builds its own clients is untestable, and how to test Java Lambda functions at every level.

4. Capstone Case Studies

Design and defend Java serverless solutions with production constraints.

  1. Capstone: Cut a Spring Boot Function's Cold Start from 8 Seconds — Plan and justify the changes that bring a Spring Boot Lambda function's cold start under one second.
  2. Capstone: Event-Driven Invoice Processing in Java — Design a Java serverless pipeline that turns supplier invoices into payments without duplicates or lost documents.