It look like there is no good source on how to do this, the two places where I have found information are the following:
First link. This looks to be the most up to date version. However I am not able to find the software.amazon.awssdk.http.apache.ApacheHttpClient anywhere in my project even when I have the dependency.
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<artifactId>aws-http-client-apache</artifactId>
<groupId>software.amazon.awssdk</groupId>
<version>2.0.0-preview-1</version>
</dependency>
The second link looks to provide an outdated version on how to configure clients. The following code in the example looks not to be valid:
DynamoDBClient client =
DynamoDBClient.builder()
.httpConfiguration(ClientHttpConfiguration.builder()
.httpClientFactory(apacheClientFactory)
.build())
.build();
ClientHttpConfiguration Is not available and the httpConfiguration method is not available on the clients.
Trying to hack something together gives me the following code:
ProxyConfiguration proxyConfiguration = ProxyConfiguration.builder().endpoint(URI.create("host:port")).username("usr").password("pwd").build();
SdkHttpClient apacheClientFactory =
ApacheSdkHttpClientFactory.builder()
.socketTimeout(Duration.ofSeconds(10))
.connectionTimeout(Duration.ofMillis(750))
.proxyConfiguration(proxyConfiguration).build().createHttpClient();
this.s3client = S3Client.builder().httpClient(apacheClientFactory).build();
This compiles but I get lots of java.lang.ClassNotFoundException: software.amazon.awssdk.http.ExecutableHttpRequest exceptions that I dont understand where they are coming from or how to fix.
So my question is what is the correct way to setup a proxy for the
2.3.2version of AWS Java SDK v2 and why is my implementation not working?
Update
When I add the following dependency I get another error:
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<version>2.3.2</version>
</dependency>
Error:
Caused by: java.lang.ClassNotFoundException: software.amazon.awssdk.http.SdkHttpClient$Builder