The AWS SDK for Java 2.x introduces the Apache 5 SDK HTTP client which is built on Apache HttpClient 5.5.x. This new SDK HTTP client is available alongside our existing SDK HTTP clients: Apache HttpClient 4.5.x, Netty, URL Connection, and AWS CRT HttpClient. To differentiate the use of Apache HttpClient 4.5.x and Apache HttpClient 5.5.x, we introduced a new Apache 5 Maven package and classes for this release.
What’s new
Similar to our existing Apache 4.5.x based client, this new client supports only synchronous operations. This client implementation uses Apache HttpClient 5.5.x, bringing the following key improvements:
- modern Java ecosystem compatibility including virtual thread support for Java 21
- active maintenance with regular security updates
- enhanced logging flexibility through SLF4J
These improvements address critical pain points with the Apache HttpClient 4.5.x based client. Specifically the move to Apache 5 addresses the 4.5.x client’s transition to maintenance mode, problematic JCL logging dependencies that trigger security tool alerts, and limited modern Java support.
Getting started
Add the Apache 5 client dependency
To begin using the Apache 5 HTTP client implementation, add the following dependency to your project:
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache5-client</artifactId>
<version>2.32.0-PREVIEW</version>
</dependency>
Configure your AWS service client
You can easily configure any AWS service client to use the new AWS SDK Apache 5 HTTP client:
S3Client s3Client = S3Client.builder()
.httpClient(Apache5HttpClient.create())
.build();
Advanced configuration example
Apache5HttpClient httpClient = Apache5HttpClient.builder()
.connectionTimeout(Duration.ofSeconds(30))
.maxConnections(100)
.build();
DynamoDbClient dynamoDbClient = DynamoDbClient.builder()
.httpClient(httpClient)
.build();
Migrate from Apache 4.5.x
If you’re currently using the default Apache HTTP Client (4.5.x), migration is straightforward – add the new dependency and update your client configuration with an Apache 5 HTTP client as shown above. The API remains consistent with other HTTP client implementations in the SDK. Note that like the existing Apache 4.5.x HTTP client, this implementation supports synchronous service clients only.
Developer Preview release
This is a Developer Preview release intended for evaluation and feedback purposes. While we tested the implementation, we recommend using it in development and testing environments before deploying to production. Your feedback during this preview period is invaluable in helping us refine the implementation before general availability.
Conclusion
In this blog post, we showed you how to get started with the new Apache 5 HTTP client in the AWS SDK for Java 2.x, which uses Apache HttpClient 5.5.x. We want your feedback on this new HTTP client during the Developer Preview phase. Please share your experience and any feature requests by opening a GitHub issue.