Skip to content

v2.11.0

Latest

Choose a tag to compare

@github-actions github-actions released this 08 Oct 14:37
· 56 commits to main since this release
000f996

Summary

📣 Starting with this release, Powertools for AWS Lambda (Java) requires Java 17 or later. If your functions still run on the java11 runtime, we recommend that you upgrade to Java 21 or 25 to get the latest features and fixes.

This release also adds an S3 bucket allowlist to the Large Messages utility, automatic tenant ID logging for functions that use Lambda tenant isolation, and SnapStart priming for the Large Messages utility. We fixed a bug that stopped SnapStart priming from loading any classes in the Tracing utility, and we updated Jackson and Logback to address 10 CVEs.

🌟 Thanks to @David-DAM, @pascalknupper, and @Pratapchandradeo for contributing for the first time!

⚠️ Java 17 Minimum Version

Upgrade guide

Powertools for AWS Lambda (Java) now compiles to Java 17 bytecode and no longer supports Java 11. Move your functions to the java17, java21, or java25 Lambda runtime before you upgrade. The public API is unchanged, so you don't need to change your code.

The change stays within v2, as our versioning policy allows. Java 11 blocked upgrades to dependencies such as JUnit 6 and protobuf-maven-plugin. See the announcement for details.

✨ Allowed Buckets in Large Messages

Docs

The message sender chooses the S3 bucket in a large message pointer. To limit the buckets the utility reads from and deletes from, pass an allowlist to LargeMessageConfig. If a pointer names a bucket that is not in the list, the utility throws LargeMessageProcessingException before it calls S3. The allowlist is empty by default, and an empty list applies no restriction, so existing functions behave as before. The allowlist works with the @LargeMessage annotation and with the functional API.

We recommend that you also scope your function's IAM policy to the offload bucket.

Basic usage:

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.SQSBatchResponse;
import com.amazonaws.services.lambda.runtime.events.SQSEvent;
import java.util.Set;
import software.amazon.lambda.powertools.largemessages.LargeMessageConfig;
import software.amazon.lambda.powertools.largemessages.LargeMessages;

public class SqsMessageHandler implements RequestHandler<SQSEvent, SQSBatchResponse> {

    public SqsMessageHandler() {
        LargeMessageConfig.init().withAllowedBuckets(Set.of("my-offload-bucket"));
    }

    @Override
    public SQSBatchResponse handleRequest(SQSEvent event, Context context) {
        for (SQSEvent.SQSMessage message : event.getRecords()) {
            // throws LargeMessageProcessingException if the bucket is not in the allowlist
            LargeMessages.processLargeMessage(message, this::processRawMessage);
        }
        return SQSBatchResponse.builder().build();
    }

    private String processRawMessage(SQSEvent.SQSMessage sqsMessage) {
        // sqsMessage.getBody() contains the content of the S3 object
        return sqsMessage.getBody();
    }
}

✨ Tenant ID in Logging

Lambda tenant isolation

If your function uses Lambda tenant isolation, Logger now adds the tenant ID next to the other Lambda context fields, such as function_request_id. The field is tenant_id in the JSON format and tenant.id in the ECS format. You don't need to change your code. Logger leaves out the field when the tenant ID is null or empty. This works with Log4j2 and Logback.

Example output:

{
    "level": "INFO",
    "message": "Processing order",
    "function_request_id": "c6af9ac6-7b61-11e6-9a41-93e812345678",
    "tenant_id": "tenant-a",
    ...
}

✨ SnapStart Priming for Large Messages

Docs

The Large Messages utility now supports CRaC. It loads its classes before SnapStart takes the snapshot, which reduces restore duration. To let the utility register before the snapshot, reference LargeMessages in your handler's initialization code.

Static initializer:

import software.amazon.lambda.powertools.largemessages.LargeMessages;

public class SqsMessageHandler implements RequestHandler<SQSEvent, SQSBatchResponse> {

    static {
        LargeMessages.init(); // registers LargeMessages for SnapStart priming
    }

    // ...
}

🔒 Bug Fixes and Security Updates

  • SnapStart priming in the Tracing utility loaded 0 classes. Its classesloaded.txt file has a leading space on each line, and the class loader kept that space in the class names. The loader now strips the space, and a deployed test function loaded 4,062 classes during priming instead of 0 (#2560).
  • We updated Jackson to 2.22.3 to address CVE-2026-54513, CVE-2026-89425, CVE-2026-89407, CVE-2026-91777, CVE-2026-68497, and CVE-2026-91776. Large Messages, Kafka, and Tracing now declare their Jackson dependencies explicitly. Before this change, your build resolved older versions through transitive dependencies, such as jackson-databind 2.15.2 in Large Messages. Tracing also moves to X-Ray SDK 2.21.1 (#2574, #2640, #2653).
  • We updated logback-classic to 1.5.38 to address CVE-2025-11226, CVE-2026-1225, CVE-2026-9828, and CVE-2026-10532 (#2644).
  • kafka-clients 4.2.0 depends on lz4-java 1.10.1, which is affected by CVE-2026-59949. The Kafka utility declares kafka-clients with provided scope, so your build resolves lz4-java through your own kafka-clients dependency. Pin at.yawk.lz4:lz4-java to 1.11.2 in your build to address the CVE. We pinned it in the Kafka example (#2656).

Changes

🐛 Bug and hot fixes

  • fix(common): strip leading whitespace in ClassPreLoader (#2560) by @phipag

This release was made possible by the following contributors:

@David-DAM, @dreamorosi, @pascalknupper, @phipag, @Pratapchandradeo