or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

arn-support.mdauthentication.mdclient-builders.mdendpoint-discovery.mdexception-handling.mdhttp-transport.mdindex.mdmetrics-monitoring.mdprotocols.mdregions-endpoints.mdretry-policies.mdutilities.mdwaiters.md

http-transport.mddocs/

0

# HTTP Transport & Client Configuration

1

2

The AWS Java SDK Core provides comprehensive HTTP client management with support for connection pooling, SSL/TLS configuration, proxy settings, timeouts, and request/response handling.

3

4

## Core HTTP Classes

5

6

### HTTP Client

7

8

```java { .api }

9

// Main HTTP client for AWS requests

10

class AmazonHttpClient {

11

public AmazonHttpClient(ClientConfiguration config);

12

public AmazonHttpClient(ClientConfiguration config,

13

RequestMetricCollector requestMetricCollector);

14

15

public <T> Response<T> requestExecutionBuilder()

16

.request(Request<?> request)

17

.originalRequest(AmazonWebServiceRequest originalRequest)

18

.executionContext(ExecutionContext executionContext)

19

.errorResponseHandler(HttpResponseHandler<? extends SdkBaseException> errorResponseHandler)

20

.execute(HttpResponseHandler<T> responseHandler);

21

}

22

23

// HTTP response representation

24

class HttpResponse {

25

public HttpResponse(Request<?> request, HttpRequestBase httpRequest);

26

public InputStream getContent();

27

public Map<String, String> getHeaders();

28

public int getStatusCode();

29

public String getStatusText();

30

public HttpRequestBase getHttpRequest();

31

public Request<?> getOriginalRequest();

32

}

33

34

// HTTP response handler interface

35

interface HttpResponseHandler<T> {

36

T handle(HttpResponse response) throws Exception;

37

boolean needsConnectionLeftOpen();

38

}

39

40

// HTTP method enumeration

41

enum HttpMethodName {

42

GET, HEAD, POST, PUT, DELETE, OPTIONS, PATCH;

43

44

public String toString();

45

}

46

47

// SDK HTTP metadata

48

class SdkHttpMetadata {

49

public int getHttpStatusCode();

50

public Map<String, String> getHttpHeaders();

51

public long getContentLength();

52

public String getContentType();

53

}

54

55

// Execution context for requests

56

class ExecutionContext {

57

public List<RequestHandler2> getRequestHandler2s();

58

public RequestMetricCollector getAwsRequestMetrics();

59

public AWSCredentials getCredentials();

60

public AWSCredentialsProvider getCredentialsProvider();

61

public ExecutionContext withCredentials(AWSCredentials credentials);

62

public ExecutionContext withCredentialsProvider(AWSCredentialsProvider credentialsProvider);

63

}

64

```

65

66

### Response Handlers

67

68

```java { .api }

69

// JSON response handler

70

class JsonResponseHandler<T> implements HttpResponseHandler<T> {

71

public JsonResponseHandler(Unmarshaller<T, JsonUnmarshallerContext> responseUnmarshaller);

72

public T handle(HttpResponse response) throws Exception;

73

public boolean needsConnectionLeftOpen();

74

}

75

76

// JSON error response handler

77

class JsonErrorResponseHandler implements HttpResponseHandler<SdkBaseException> {

78

public JsonErrorResponseHandler(

79

List<JsonErrorUnmarshallerV2> errorUnmarshallers);

80

public SdkBaseException handle(HttpResponse response) throws Exception;

81

public boolean needsConnectionLeftOpen();

82

}

83

84

// StAX XML response handler

85

class StaxResponseHandler<T> implements HttpResponseHandler<T> {

86

public StaxResponseHandler(Unmarshaller<T, StaxUnmarshallerContext> responseUnmarshaller);

87

public T handle(HttpResponse response) throws Exception;

88

public boolean needsConnectionLeftOpen();

89

}

90

91

// Default error response handler

92

class DefaultErrorResponseHandler implements HttpResponseHandler<SdkBaseException> {

93

public DefaultErrorResponseHandler(

94

List<Unmarshaller<SdkBaseException, Node>> exceptionUnmarshallers);

95

public SdkBaseException handle(HttpResponse response) throws Exception;

96

public boolean needsConnectionLeftOpen();

97

}

98

99

// RPC v2 CBOR response handler

100

class RpcV2CborResponseHandler<T> implements HttpResponseHandler<T> {

101

public RpcV2CborResponseHandler(

102

Unmarshaller<T, JsonUnmarshallerContext> responseUnmarshaller);

103

public T handle(HttpResponse response) throws Exception;

104

public boolean needsConnectionLeftOpen();

105

}

106

107

// RPC v2 CBOR error response handler

108

class RpcV2CborErrorResponseHandler implements HttpResponseHandler<SdkBaseException> {

109

public RpcV2CborErrorResponseHandler(

110

List<JsonErrorUnmarshallerV2> errorUnmarshallers);

111

public SdkBaseException handle(HttpResponse response) throws Exception;

112

public boolean needsConnectionLeftOpen();

113

}

114

```

115

116

## Client Configuration

117

118

### Core Configuration

119

120

```java { .api }

121

// HTTP client and proxy configuration

122

class ClientConfiguration {

123

// Connection settings

124

public ClientConfiguration withMaxConnections(int maxConnections);

125

public ClientConfiguration withConnectionTimeout(int connectionTimeout);

126

public ClientConfiguration withSocketTimeout(int socketTimeout);

127

public ClientConfiguration withConnectionTTL(long connectionTTL);

128

public ClientConfiguration withConnectionMaxIdleMillis(long connectionMaxIdleMillis);

129

public ClientConfiguration withValidateAfterInactivityMillis(int validateAfterInactivityMillis);

130

131

// Retry settings

132

public ClientConfiguration withRetryPolicy(RetryPolicy retryPolicy);

133

public ClientConfiguration withMaxErrorRetry(int maxErrorRetry);

134

public ClientConfiguration withThrottledRetries(boolean throttledRetries);

135

136

// Proxy settings

137

public ClientConfiguration withProxyHost(String proxyHost);

138

public ClientConfiguration withProxyPort(int proxyPort);

139

public ClientConfiguration withProxyUsername(String proxyUsername);

140

public ClientConfiguration withProxyPassword(String proxyPassword);

141

public ClientConfiguration withProxyDomain(String proxyDomain);

142

public ClientConfiguration withProxyWorkstation(String proxyWorkstation);

143

public ClientConfiguration withNonProxyHosts(String nonProxyHosts);

144

public ClientConfiguration withProxyAuthenticationMethods(Set<ProxyAuthenticationMethod> methods);

145

146

// SSL/TLS settings

147

public ClientConfiguration withProtocol(Protocol protocol);

148

public ClientConfiguration withSecureRandom(SecureRandom secureRandom);

149

public ClientConfiguration withTrustAllCertificates(boolean trustAllCertificates);

150

151

// Advanced settings

152

public ClientConfiguration withUserAgent(String userAgent);

153

public ClientConfiguration withUserAgentPrefix(String userAgentPrefix);

154

public ClientConfiguration withUserAgentSuffix(String userAgentSuffix);

155

public ClientConfiguration withRequestTimeout(int requestTimeout);

156

public ClientConfiguration withClientExecutionTimeout(int clientExecutionTimeout);

157

public ClientConfiguration withTcpKeepAlive(boolean tcpKeepAlive);

158

public ClientConfiguration withDnsResolver(DnsResolver dnsResolver);

159

public ClientConfiguration withCacheResponseMetadata(boolean cacheResponseMetadata);

160

public ClientConfiguration withResponseMetadataCacheSize(int responseMetadataCacheSize);

161

public ClientConfiguration withHeader(String name, String value);

162

163

// Getters

164

public int getMaxConnections();

165

public int getConnectionTimeout();

166

public int getSocketTimeout();

167

public long getConnectionTTL();

168

public long getConnectionMaxIdleMillis();

169

public int getValidateAfterInactivityMillis();

170

public RetryPolicy getRetryPolicy();

171

public int getMaxErrorRetry();

172

public String getProxyHost();

173

public int getProxyPort();

174

public String getProxyUsername();

175

public String getProxyPassword();

176

public String getProxyDomain();

177

public String getProxyWorkstation();

178

public String getNonProxyHosts();

179

public Protocol getProtocol();

180

public SecureRandom getSecureRandom();

181

public boolean trustAllCertificates();

182

public String getUserAgent();

183

public String getUserAgentPrefix();

184

public String getUserAgentSuffix();

185

public int getRequestTimeout();

186

public int getClientExecutionTimeout();

187

public boolean useTcpKeepAlive();

188

public DnsResolver getDnsResolver();

189

public boolean getCacheResponseMetadata();

190

public int getResponseMetadataCacheSize();

191

public Map<String, String> getHeaders();

192

}

193

194

// Factory for client configurations

195

class ClientConfigurationFactory {

196

public ClientConfiguration getConfig();

197

}

198

199

// Pre-configured client settings

200

class PredefinedClientConfigurations {

201

public static ClientConfiguration defaultConfig();

202

public static ClientConfiguration standard();

203

}

204

205

// Per-request configuration

206

class RequestConfig {

207

public static RequestConfig NO_OP;

208

209

public RequestConfig withRequestTimeout(int requestTimeout);

210

public RequestConfig withClientExecutionTimeout(int clientExecutionTimeout);

211

public RequestConfig withProgressListener(ProgressListener progressListener);

212

public RequestConfig withRequestMetricCollector(RequestMetricCollector requestMetricCollector);

213

public RequestConfig withRequestClientOptions(RequestClientOptions requestClientOptions);

214

public RequestConfig withCredentialsProvider(AWSCredentialsProvider credentialsProvider);

215

216

public int getRequestTimeout();

217

public int getClientExecutionTimeout();

218

public ProgressListener getProgressListener();

219

public RequestMetricCollector getRequestMetricCollector();

220

public RequestClientOptions getRequestClientOptions();

221

public AWSCredentialsProvider getCredentialsProvider();

222

}

223

224

// Request-specific options

225

class RequestClientOptions {

226

public RequestClientOptions withReadLimit(int readLimit);

227

public RequestClientOptions withSkipAppendUriPath(boolean skipAppendUriPath);

228

229

public int getReadLimit();

230

public boolean isSkipAppendUriPath();

231

}

232

```

233

234

### Protocol and Authentication Enums

235

236

```java { .api }

237

// Service protocols

238

enum Protocol {

239

HTTP("http", 80, false),

240

HTTPS("https", 443, true);

241

242

public String toString();

243

public int getDefaultPort();

244

public boolean isSecure();

245

}

246

247

// Proxy authentication methods

248

enum ProxyAuthenticationMethod {

249

BASIC("Basic"),

250

DIGEST("Digest"),

251

KERBEROS("Kerberos"),

252

NTLM("NTLM"),

253

SPNEGO("SPNEGO");

254

255

public String toString();

256

}

257

```

258

259

## HTTP Client Implementation

260

261

### Apache HTTP Client Support

262

263

```java { .api }

264

// Factory for Apache HTTP clients

265

class ApacheHttpClientFactory {

266

public static ConnectionManagerAwareHttpClient create(ClientConfiguration config);

267

public static ConnectionManagerAwareHttpClient create(ClientConfiguration config,

268

RequestMetricCollector requestMetricCollector);

269

}

270

271

// Factory for connection managers

272

class ApacheConnectionManagerFactory {

273

public static HttpClientConnectionManager create(ClientConfiguration config,

274

RequestMetricCollector requestMetricCollector);

275

}

276

277

// Connection manager aware HTTP client

278

interface ConnectionManagerAwareHttpClient extends HttpClient {

279

HttpClientConnectionManager getHttpClientConnectionManager();

280

}

281

282

// SDK HTTP client wrapper

283

class SdkHttpClient implements ConnectionManagerAwareHttpClient {

284

public SdkHttpClient(HttpClient httpClient, HttpClientConnectionManager connectionManager);

285

public HttpResponse execute(HttpUriRequest request) throws IOException;

286

public HttpClientConnectionManager getHttpClientConnectionManager();

287

}

288

289

// Factory for Apache HTTP requests

290

class ApacheHttpRequestFactory implements HttpRequestFactory {

291

public HttpRequestBase createHttpRequest(String uri, HttpMethodName httpMethod);

292

}

293

294

// HTTP GET with request body support

295

class HttpGetWithBody extends HttpEntityEnclosingRequestBase {

296

public HttpGetWithBody(String uri);

297

public HttpGetWithBody(URI uri);

298

public String getMethod();

299

}

300

301

// Proxy route planner

302

class SdkProxyRoutePlanner extends DefaultProxyRoutePlanner {

303

public SdkProxyRoutePlanner(String proxyHost, int proxyPort, Protocol protocol,

304

String nonProxyHosts);

305

public HttpRoute determineRoute(HttpHost host, HttpRequest request,

306

HttpContext context) throws HttpException;

307

}

308

309

// Apache HTTP client utilities

310

class ApacheUtils {

311

public static boolean isRequestSuccessful(HttpResponse response);

312

public static HttpEntity newStringEntity(String s);

313

public static HttpEntity newByteArrayEntity(byte[] content);

314

public static HttpEntity newInputStreamEntity(InputStream content, long contentLength);

315

}

316

```

317

318

### Connection Management

319

320

```java { .api }

321

// Factory for connection managers

322

interface ClientConnectionManagerFactory {

323

HttpClientConnectionManager create(ClientConfiguration config);

324

}

325

326

// Generic connection manager factory

327

interface ConnectionManagerFactory<T> {

328

T create(ClientConfiguration config);

329

}

330

331

// Keep-alive strategy

332

class SdkConnectionKeepAliveStrategy implements ConnectionKeepAliveStrategy {

333

public long getKeepAliveDuration(HttpResponse response, HttpContext context);

334

}

335

336

// Plain socket factory

337

class SdkPlainSocketFactory extends PlainConnectionSocketFactory {

338

public Socket createSocket(HttpContext context) throws IOException;

339

public Socket connectSocket(int connectTimeout, Socket socket, HttpHost host,

340

InetSocketAddress remoteAddress, InetSocketAddress localAddress,

341

HttpContext context) throws IOException;

342

}

343

```

344

345

### SSL/TLS Support

346

347

```java { .api }

348

// TLS socket factory

349

class SdkTLSSocketFactory extends SSLConnectionSocketFactory {

350

public SdkTLSSocketFactory(SSLContext sslContext, HostnameVerifier hostnameVerifier);

351

public Socket createLayeredSocket(Socket socket, String target, int port,

352

HttpContext context) throws IOException;

353

public Socket connectSocket(int connectTimeout, Socket socket, HttpHost host,

354

InetSocketAddress remoteAddress, InetSocketAddress localAddress,

355

HttpContext context) throws IOException;

356

}

357

358

// TLS key managers provider interface

359

interface TlsKeyManagersProvider {

360

KeyManager[] getKeyManagers();

361

}

362

363

// No-operation TLS key managers provider

364

class NoneTlsKeyManagersProvider implements TlsKeyManagersProvider {

365

public KeyManager[] getKeyManagers();

366

}

367

368

// Master secret validators

369

class MasterSecretValidators {

370

public static final MasterSecretValidator DENY_ALL;

371

public static final MasterSecretValidator ALLOW_ALL;

372

}

373

374

// SSL session clearing predicate

375

interface ShouldClearSslSessionPredicate {

376

boolean shouldClear();

377

}

378

379

// Privileged master secret validator

380

class PrivilegedMasterSecretValidator implements MasterSecretValidator {

381

public boolean isMasterSecretValid(Object masterSecret);

382

}

383

```

384

385

### HTTP Configuration

386

387

```java { .api }

388

// HTTP client settings

389

class HttpClientSettings {

390

public int getMaxConnections();

391

public int getConnectionTimeout();

392

public int getSocketTimeout();

393

public long getConnectionTTL();

394

public long getConnectionMaxIdleMillis();

395

public int getValidateAfterInactivityMillis();

396

public boolean useTcpKeepAlive();

397

public String getProxyHost();

398

public int getProxyPort();

399

public String getProxyUsername();

400

public String getProxyPassword();

401

public String getNonProxyHosts();

402

public Protocol getProtocol();

403

public SecureRandom getSecureRandom();

404

public TlsKeyManagersProvider getTlsKeyManagersProvider();

405

public boolean trustAllCertificates();

406

}

407

408

// Factory for HTTP requests

409

interface HttpRequestFactory {

410

HttpRequestBase createHttpRequest(String uri, HttpMethodName httpMethod);

411

}

412

413

// Repeatable input stream request entity

414

class RepeatableInputStreamRequestEntity extends AbstractHttpEntity

415

implements Repeatable {

416

public RepeatableInputStreamRequestEntity(InputStream content, long contentLength);

417

public boolean isRepeatable();

418

public long getContentLength();

419

public InputStream getContent() throws IOException;

420

public void writeTo(OutputStream outstream) throws IOException;

421

}

422

423

// Delegating DNS resolver

424

class DelegatingDnsResolver implements DnsResolver {

425

public DelegatingDnsResolver(DnsResolver delegate);

426

public InetAddress[] resolve(String host) throws UnknownHostException;

427

}

428

```

429

430

## Timers and Timeouts

431

432

### Execution Timers

433

434

```java { .api }

435

// Timer for client execution

436

class ClientExecutionTimer {

437

public ClientExecutionTimer();

438

public void startTimer(ClientExecutionAbortTask clientExecutionAbortTask);

439

public boolean hasTimeoutExpired();

440

public boolean isEnabled();

441

public void abortTimer();

442

}

443

444

// Task for aborting client execution

445

class ClientExecutionAbortTask extends TimerTask {

446

public ClientExecutionAbortTask(AmazonHttpClient client, HttpRequestBase httpRequest);

447

public void run();

448

public boolean hasClientExecutionAborted();

449

public boolean hasTimeoutExpired();

450

public void setCurrentHttpRequest(HttpRequestBase currentHttpRequest);

451

}

452

453

// Client execution timeout exception

454

class ClientExecutionTimeoutException extends SdkClientException {

455

public ClientExecutionTimeoutException(String message);

456

}

457

458

// Timer for HTTP requests

459

class HttpRequestTimer {

460

public HttpRequestTimer();

461

public void startTimer(HttpRequestAbortTask httpRequestAbortTask);

462

public boolean hasTimeoutExpired();

463

public boolean isEnabled();

464

public void abortTimer();

465

}

466

467

// Task for aborting HTTP requests

468

class HttpRequestAbortTask extends TimerTask {

469

public HttpRequestAbortTask(HttpRequestBase httpRequest);

470

public void run();

471

public boolean hasRequestAborted();

472

public boolean hasTimeoutExpired();

473

}

474

475

// Builder for timeout thread pools

476

class TimeoutThreadPoolBuilder {

477

public TimeoutThreadPoolBuilder threadNamePrefix(String threadNamePrefix);

478

public ScheduledThreadPoolExecutor build();

479

}

480

```

481

482

## Usage Examples

483

484

### Basic HTTP Client Configuration

485

486

```java

487

import com.amazonaws.ClientConfiguration;

488

import com.amazonaws.Protocol;

489

import com.amazonaws.retry.PredefinedRetryPolicies;

490

491

// Basic client configuration

492

ClientConfiguration config = new ClientConfiguration()

493

.withMaxConnections(100)

494

.withConnectionTimeout(5000) // 5 seconds

495

.withSocketTimeout(30000) // 30 seconds

496

.withRetryPolicy(PredefinedRetryPolicies.DEFAULT)

497

.withProtocol(Protocol.HTTPS)

498

.withTcpKeepAlive(true);

499

500

// Advanced configuration

501

ClientConfiguration advancedConfig = new ClientConfiguration()

502

.withMaxConnections(200)

503

.withConnectionTimeout(10000)

504

.withSocketTimeout(60000)

505

.withConnectionTTL(300000) // 5 minutes

506

.withConnectionMaxIdleMillis(60000) // 1 minute

507

.withRequestTimeout(120000) // 2 minutes

508

.withClientExecutionTimeout(300000) // 5 minutes

509

.withRetryPolicy(PredefinedRetryPolicies.DEFAULT_MAX_ERROR_RETRY);

510

```

511

512

### Proxy Configuration

513

514

```java

515

import com.amazonaws.ClientConfiguration;

516

import com.amazonaws.ProxyAuthenticationMethod;

517

import java.util.*;

518

519

// Basic proxy configuration

520

ClientConfiguration proxyConfig = new ClientConfiguration()

521

.withProxyHost("proxy.company.com")

522

.withProxyPort(8080);

523

524

// Authenticated proxy configuration

525

ClientConfiguration authenticatedProxyConfig = new ClientConfiguration()

526

.withProxyHost("proxy.company.com")

527

.withProxyPort(8080)

528

.withProxyUsername("username")

529

.withProxyPassword("password");

530

531

// Advanced proxy configuration

532

Set<ProxyAuthenticationMethod> authMethods = new HashSet<>();

533

authMethods.add(ProxyAuthenticationMethod.BASIC);

534

authMethods.add(ProxyAuthenticationMethod.DIGEST);

535

536

ClientConfiguration advancedProxyConfig = new ClientConfiguration()

537

.withProxyHost("proxy.company.com")

538

.withProxyPort(8080)

539

.withProxyUsername("username")

540

.withProxyPassword("password")

541

.withProxyDomain("DOMAIN")

542

.withProxyWorkstation("WORKSTATION")

543

.withNonProxyHosts("localhost|127.0.0.1|*.company.com")

544

.withProxyAuthenticationMethods(authMethods);

545

```

546

547

### SSL/TLS Configuration

548

549

```java

550

import com.amazonaws.ClientConfiguration;

551

import com.amazonaws.Protocol;

552

import java.security.SecureRandom;

553

554

// Basic HTTPS configuration

555

ClientConfiguration httpsConfig = new ClientConfiguration()

556

.withProtocol(Protocol.HTTPS);

557

558

// Custom SSL configuration

559

SecureRandom secureRandom = new SecureRandom();

560

ClientConfiguration customSslConfig = new ClientConfiguration()

561

.withProtocol(Protocol.HTTPS)

562

.withSecureRandom(secureRandom);

563

564

// Trust all certificates (NOT recommended for production)

565

ClientConfiguration trustAllConfig = new ClientConfiguration()

566

.withProtocol(Protocol.HTTPS)

567

.withTrustAllCertificates(true);

568

```

569

570

### Custom DNS Resolver

571

572

```java

573

import com.amazonaws.ClientConfiguration;

574

import com.amazonaws.DnsResolver;

575

import java.net.*;

576

import java.util.*;

577

578

// Custom DNS resolver implementation

579

public class CustomDnsResolver implements DnsResolver {

580

@Override

581

public InetAddress[] resolve(String host) throws UnknownHostException {

582

// Custom DNS resolution logic

583

if ("my-custom-service.com".equals(host)) {

584

return new InetAddress[]{InetAddress.getByName("192.168.1.100")};

585

}

586

return InetAddress.getAllByName(host);

587

}

588

}

589

590

// Use custom DNS resolver

591

ClientConfiguration config = new ClientConfiguration()

592

.withDnsResolver(new CustomDnsResolver());

593

```

594

595

### Request-Level Configuration

596

597

```java

598

import com.amazonaws.RequestConfig;

599

import com.amazonaws.event.ProgressListener;

600

import com.amazonaws.metrics.RequestMetricCollector;

601

602

// Request-specific timeout configuration

603

RequestConfig requestConfig = RequestConfig.NO_OP

604

.withRequestTimeout(60000) // 1 minute

605

.withClientExecutionTimeout(120000); // 2 minutes

606

607

// Request with progress tracking

608

ProgressListener progressListener = new ProgressListener() {

609

@Override

610

public void progressChanged(ProgressEvent progressEvent) {

611

System.out.println("Progress: " + progressEvent.getBytesTransferred());

612

}

613

};

614

615

RequestConfig progressConfig = RequestConfig.NO_OP

616

.withProgressListener(progressListener);

617

```

618

619

### HTTP Response Handling

620

621

```java

622

import com.amazonaws.http.*;

623

import com.amazonaws.transform.Unmarshaller;

624

625

// Custom response handler

626

HttpResponseHandler<String> customHandler = new HttpResponseHandler<String>() {

627

@Override

628

public String handle(HttpResponse response) throws Exception {

629

// Read response content

630

InputStream content = response.getContent();

631

// Convert to string and return

632

return IOUtils.toString(content);

633

}

634

635

@Override

636

public boolean needsConnectionLeftOpen() {

637

return false;

638

}

639

};

640

641

// JSON response handler with unmarshaller

642

Unmarshaller<MyObject, JsonUnmarshallerContext> unmarshaller =

643

new MyObjectJsonUnmarshaller();

644

JsonResponseHandler<MyObject> jsonHandler =

645

new JsonResponseHandler<>(unmarshaller);

646

```

647

648

## Best Practices

649

650

1. **Connection Pooling**: Configure appropriate max connections based on your application's concurrency needs.

651

652

2. **Timeout Configuration**: Set reasonable connection, socket, and request timeouts to prevent hanging requests.

653

654

3. **Retry Policies**: Use appropriate retry policies for your use case, considering both client and service-side errors.

655

656

4. **Proxy Configuration**: Properly configure proxy settings for corporate environments, including authentication.

657

658

5. **SSL/TLS Security**: Use secure configurations and avoid `trustAllCertificates` in production environments.

659

660

6. **Resource Management**: Ensure HTTP clients and connection managers are properly closed to prevent resource leaks.

661

662

7. **DNS Resolution**: Use custom DNS resolvers for advanced networking scenarios or service discovery.

663

664

8. **Monitoring**: Implement request metric collectors to monitor HTTP performance and errors.

665

666

The HTTP transport layer provides comprehensive support for all aspects of HTTP communication with AWS services, enabling reliable and efficient network operations with extensive configuration options.