It seems like you still have to have both SDK v1 and SDK v2 on your classpath.

For example, looking at the Lambda Java documentation you can see that all imports still start with com.amazonaws (SDK v1) and not software.amazon (SDK v2).

One of the examples they list there is blank-java which they describe as "A Java function with the events library, advanced logging configuration, and the AWS SDK for Java 2.x that calls the Lambda API to retrieve account settings"

If you look at that sample application's pom.xml you'll see com.amazonaws and software.amazon packages mixed together.

Similarly for the Lambda handler.

So either they haven't ported everything to SDK v2, or they still want you to use the interfaces from SDK v1 - and then more functional code (non interface code) can be used from SDK v2.

Answer from dutoitns on Stack Overflow
🌐
AWS
docs.aws.amazon.com › aws sdk for java › developer guide for version 2.x › sdk for java 2.x code examples › lambda examples using sdk for java 2.x
Lambda examples using SDK for Java 2.x - AWS SDK for Java 2.x
The following code example shows how to create an AWS Step Functions state machine that invokes AWS Lambda functions in sequence. ... Shows how to create an AWS serverless workflow by using AWS Step Functions and the AWS SDK for Java 2.x.
🌐
Maven Repository
mvnrepository.com › artifact › com.amazonaws › aws-lambda-java-core
Maven Repository: com.amazonaws » aws-lambda-java-core
September 3, 2025 - Java Specifications · Core Utilities · Mocking · Annotation Libraries · Web Assets · HTTP Clients · Logging Bridges · Dependency Injection · XML Processing · Concurrency Libraries · Web Frameworks · Android Platform · Code Generators · View All · Home » com.amazonaws » aws-lambda-java-core ·
🌐
AWS
aws.amazon.com › blogs › compute › introducing-v2-of-powertools-for-aws-lambda-java
Introducing v2 of Powertools for AWS Lambda (Java) | Amazon Web Services
July 31, 2025 - A key feature in Powertools for AWS Lambda (Java) v2 is GraalVM native image support for all core utilities. Compiling your Lambda functions to native executables allows you to significantly reduce cold start times and memory usage. Using Powertools v2 with GraalVM allows you to reduce cold starts up to 75.61% (p95) compared to using the managed Java runtime.
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with java
Building Lambda functions with Java - AWS Lambda
The Hello class has a function named handleRequest that takes an event object and a context object. This is the handler function that Lambda calls when the function is invoked. The Java function runtime gets invocation events from Lambda and passes them to the handler.
🌐
GitHub
github.com › aws › aws-lambda-java-libs › issues › 74
update aws lambda java libs to aws sdk java v2 · Issue #74 · aws/aws-lambda-java-libs
February 1, 2019 - update aws lambda java libs to aws sdk java v2#74 · Copy link · SeekerWing · opened · on Feb 1, 2019 · Issue body actions · update aws lambda java libs to aws sdk java v2 (https://github.com/aws/aws-sdk-java-v2) Reactions are currently unavailable · No one assigned ·
Author   SeekerWing
Find elsewhere
🌐
AWS
sdk.amazonaws.com › java › api › latest › software › amazon › awssdk › services › lambda › LambdaClient.html
LambdaClient (AWS SDK for Java - 2.42.27)
Returns a list of Lambda functions, with the version-specific configuration of each. ... List the functions that use the specified code signing configuration. ... List the functions that use the specified code signing configuration. ... This is a variant of listFunctionsByCodeSigningConfig...
🌐
Javadoc.io
javadoc.io › doc › com.amazonaws › aws-lambda-java-core › latest › index.html
aws-lambda-java-core 1.4.0 javadoc (com.amazonaws)
Bookmarks · Latest version of com.amazonaws:aws-lambda-java-core · https://javadoc.io/doc/com.amazonaws/aws-lambda-java-core · Current version 1.4.0 · https://javadoc.io/doc/com.amazonaws/aws-lambda-java-core/1.4.0 · package-list path (used for javadoc generation -link option) · ...
🌐
Medium
srilalitha1310.medium.com › invoking-an-aws-lambda-in-java-using-aws-sdk-v2-f074f495454a
Invoking an AWS lambda in Java using AWS SDK V2 | by Srilalitha S | Medium
October 27, 2020 - import software.amazon.awssdk.core.SdkBytes; import software.amazon.awssdk.services.lambda.LambdaClient; import software.amazon.awssdk.services.lambda.model.InvokeRequest; import software.amazon.awssdk.services.lambda.model.InvokeResponse; . . @Inject private LambdaClient lambdaClient; . . public YourDataClass getData() { String requestPayload = Json.createObjectBuilder() .add("payload", "dummyPayload") .build().toString(); InvokeRequest request = InvokeRequest.builder() .functionName("functionNameOfLambdaToInvoke") .payload(SdkBytes.fromUtf8String(requestPayload)) .build(); InvokeResponse res
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with java › define lambda function handler in java
Define Lambda function handler in Java - AWS Lambda
Setting up your Java handler projectExample Java Lambda function codeValid class definitions for Java handlersHandler naming conventionsDefining and accessing the input event objectAccessing and using the Lambda context objectUsing the AWS SDK for Java v2 in your handlerAccessing environment ...
🌐
AWS
docs.aws.amazon.com › aws sdk for java › developer guide for version 2.x › calling aws services from the aws sdk for java 2.x › invoke, list, and delete aws lambda functions
Invoke, list, and delete AWS Lambda functions - AWS SDK for Java 2.x
The following Java code example demonstrates how to retrieve a list of function names. public static void listFunctions(LambdaClient awsLambda) { try { ListFunctionsResponse functionResult = awsLambda.listFunctions(); List<FunctionConfiguration> list = functionResult.functions(); for (FunctionConfiguration config: list) { System.out.println("The function name is "+config.functionName()); } } catch(LambdaException e) { System.err.println(e.getMessage()); System.exit(1); } }
🌐
DZone
dzone.com › software design and architecture › cloud architecture › write your first aws lambda in java
Write Your First AWS Lambda in Java
September 21, 2020 - We are setting some properties in <properties> tag like AWS SDK version and Java Version. We are adding AWS SDK dependency and Lambda core dependency with desired version. The Google JSON dependency is added to convert between JSON and Java object and vice versa.
🌐
danvega.dev
danvega.dev › blog › aws-lambda-java-core
Building AWS Lambda Functions with Java: An Introduction to the AWS Lambda Core Java Library
November 10, 2022 - In this tutorial you will learn how to build AWS Lambda functions with Java using the AWS Lambda Core Java Library.
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with java › log and monitor java lambda functions
Log and monitor Java Lambda functions - AWS Lambda
As a result of this change, customers using Log4J2 may see an additional log entry, similar to "Transforming org/apache/logging/log4j/core/lookup/JndiLookup (java.net.URLClassLoader@...)". Any log strings that reference the jndi mapper in the Log4J2 output will be replaced with "Patched JndiLookup::lookup()". Independent of this change, we strongly encourage all customers whose functions include Log4j2 to update to the latest version. Specifically, customers using the aws-lambda-java-log4j2 library in their functions should update to version 1.5.0 (or later), and redeploy their functions.
🌐
AWS
docs.aws.amazon.com › sdk-for-java › v1 › reference › com › amazonaws › services › lambda › AWSLambda.html
AWSLambda (AWS SDK for Java - 1.12.797)
We announced the upcoming end-of-support for AWS SDK for Java (v1). We recommend that you migrate to AWS SDK for Java v2. For dates, additional details, and information on how to migrate, please refer to the linked announcement. ... Interface for accessing AWS Lambda.
🌐
Maven Central
central.sonatype.com › artifact › com.amazonaws › aws-lambda-java-core
com.amazonaws:aws-lambda-java-core - Maven Central
<project xmlns="http://maven.a... <packaging>jar</packaging> <name>AWS Lambda Java Core Library</name> <description> Minimal set of interface definitions for Java support in AWS Lambda </description> <url>https://aws.amazon.com/lambda/</url> <licenses> <license> <name>Apache ...
Top answer
1 of 2
1
Where does the client side of your code runs at (the app that is using Java SDK)? What might be happening is you're hitting the TCP Keepalive timeout. There's no traffic being sent either way on your TCP connection When SDK waits for Lambda to reply. Network appliances that you might have along the way might be closing idle connection after some period of time. For example if your app runs in a VPC environment and using NAT Gateway or VPC Endpoints for outbound connections to Lambda, the idle connections will be closed after 350 seconds. In this case the behavior will be consistent with what you're observing - the Lambda side will continue to run, and the client side will eventually timeout. If above description fits your case, you can try remediating it by doing two steps - (1) reducing the OS level TCP Keepalive time (2) enabling TCP Keepalive in Java SDK. I'm going to add some details on both steps below. > NOTE: Those steps are using advanced techniques by changing the default behavior for OS-level TCP keepalive settings and App-level HTTP client configuration. Use below description as a reference only, and make sure you understand what you're doing if you decide to apply it to real environments. This is a good article explaining TCP keepalive. 1. By default it is common for a Linux environment to be configured with 7200 seconds (2 hours) of TCP Keepalive interval, which is obviously too high for your scenario. You can see the configuration by running ``` cat /proc/sys/net/ipv4/tcp_keepalive_time cat /proc/sys/net/ipv4/tcp_keepalive_intvl ``` You can update these settings by adding below properties to `/etc/sysctl.conf` and rebooting your system. You might want to use different values. In case you do have NAT Gateway or VPC Endpoint on your path make sure your keepalive is below 350 seconds. Other network appliances might have different timeouts. Below config means wait for 120 seconds before starting to send keepalive probes, and then send them with 30 second intervals. ``` net.ipv4.tcp_keepalive_time=120 net.ipv4.tcp_keepalive_intvl=30 ``` After reboot run the same `cat` commands to make sure new settings were applied. 2. Build a custom ApacheHttpClient, enable TCP Keepalive, and use it when building your Lambda client. See below for a reference. ``` ApacheHttpClient.Builder apacheHttpClientBuilder = ApacheHttpClient.builder(); apacheHttpClientBuilder.connectionMaxIdleTime(Duration.ofSeconds(900)); apacheHttpClientBuilder.connectionTimeToLive(Duration.ofSeconds(900)); apacheHttpClientBuilder.socketTimeout(Duration.ofSeconds(900)); apacheHttpClientBuilder.tcpKeepAlive(true); SdkHttpClient sdkHttpClient = apacheHttpClientBuilder.build(); RetryPolicy retryPolicy = RetryPolicy.builder().numRetries(0).build(); ClientOverrideConfiguration clientOverrideConfiguration = ClientOverrideConfiguration.builder() .apiCallAttemptTimeout(Duration.ofSeconds(900)) .apiCallTimeout(Duration.ofSeconds(900)) .retryPolicy(retryPolicy) .build(); LambdaClientBuilder lambdaClientBuilder = LambdaClient.builder(); lambdaClientBuilder.overrideConfiguration(clientOverrideConfiguration); lambdaClientBuilder.httpClient(sdkHttpClient); LambdaClient lambdaClient = lambdaClientBuilder.build(); InvokeRequest invokeRequest = InvokeRequest.builder().functionName(FUNCTION_NAME).build(); InvokeResponse invokeResponse = lambdaClient.invoke(invokeRequest); ``` ApacheHttpClient class is coming from https://mvnrepository.com/artifact/software.amazon.awssdk/apache-client
2 of 2
0
Hi, When reading your question, I am unsure of how long you are waiting prior to receiving the timeout error. Is this error raised after several minutes, or does this get returned immediately? The max timeout for Lambda is 15 minutes. This maximum cannot be overridden, and if you are getting this error after 15 minutes, then that helps me to understand if this error is valid or not. If this is a valid error, meaning that you have exceeded the 15 minute timeout, then I suggest a different approach to solving this workload. First, you can try increasing the size of your lambda runtime. More CPUs and more memory may be the key to completing the operation within the time limit. If that does not solve the timeout, consider breaking the operation into separate activities, and have a separate lambda that runs separate operations. You can tie these different lambdas together using Step Functions. While this will take some work to separate the operations and create the Step Function job, the overall cost difference will be minor, since all of these operations are serverless. If these suggestions still do not solve this, then you will need to have your workload run in a persistent state that does not timeout. EC2 instances will meet this need.
🌐
Lumigo
lumigo.io › guides › aws lambda 101 › aws lambda java
AWS Lambda Java - Lumigo
September 17, 2024 - To build the Java function, we can use Maven or Gradle. A Deployment package for Java can be a zip file or a jar file. We can deploy functions using the AWS CLI, AWS Console, or the AWS Serverless Application Model (SAM). AWS Lambda provides a few core libraries that are required for building a Java function: