Skip to main content
skill CX Codex

aws-sdk-java-v2-core — Claude Code skill for AWS Java SDK setup

Walks through building AWS SDK for Java 2.x clients with sensible defaults: credentials, region, HTTP stack, timeouts, retries. Useful when a client fails on its first call.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a claude-code
Open on GitHub

What aws-sdk-java-v2-core does

The skill lays out client setup in order. You pick a sync client (S3Client, DynamoDbClient) or an async one (S3AsyncClient, SqsAsyncClient), then work out credential and region resolution, then the HTTP layer and limits. Sync paths get ApacheHttpClient, async paths get NettyNioAsyncHttpClient. Actual timeout and connection numbers come from your service requirements; the skill does not hand you a fixed set.

Credentials default to DefaultCredentialsProvider, which covers shared config, SSO or environment variables on a dev machine, web identity in CI, and ECS task roles, EKS IRSA or EC2 instance profiles on AWS. A StsClient.getCallerIdentity() call at startup confirms everything resolved. Do this deliberately: a wrong region or missing credentials often only show up on the first real request. In Spring Boot the clients become @Bean singletons injected through constructors, so nothing gets built inside a hot path.

Error handling sits at the integration boundary: catch SdkException, separate retryable failures from auth, quota and validation problems, and keep secrets out of logs. Integration tests run against LocalStack, Testcontainers or a sandbox account, and @PostConstruct lets the app fail fast when credentials are absent. Never put access keys or session tokens in source or config files; static credentials are for narrow local tests only. Service-specific work lives in separate skills such as S3, DynamoDB and Bedrock.

What it helps with

  • build an S3 client with explicit timeouts and a connection pool
  • find out why a client fails on the first call over region or credentials
  • wire AWS clients as Spring Boot beans instead of per-request objects
  • decide between sync and async clients for a concurrent workload
  • verify credentials at startup with getCallerIdentity

Example prompts for the agent

  • Set up an S3Client for eu-south-2 with ApacheHttpClient and 10s/30s timeouts
  • Move our SqsAsyncClient to NettyNioAsyncHttpClient with concurrency 200
  • Add a startup check in the Spring Boot config that calls StsClient.getCallerIdentity()

How to install aws-sdk-java-v2-core

1Skills CLI (Vercel)

npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a claude-code

2Manually: put the files in place

~/.claude/skills/aws-sdk-java-v2-core/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/aws-sdk-java-v2-core/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about aws-sdk-java-v2-core

How do I install aws-sdk-java-v2-core in Claude Code?

Run npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a claude-code. The skill lands in ~/.claude/skills/aws-sdk-java-v2-core/SKILL.md.

What does aws-sdk-java-v2-core do?

It covers AWS SDK for Java 2.x client configuration: credential and region resolution, HTTP client choice, timeouts, retries, lifecycle and tests. The goal is clients with production-safe defaults.

Which HTTP clients does it use for sync and async calls?

ApacheHttpClient handles sync calls, NettyNioAsyncHttpClient handles async ones. Proxy, TLS and metric publisher APIs differ by HTTP stack and SDK version, so adjust the examples to the versions your project already uses.

Source text

SKILL.md · MIT
---
name: aws-sdk-java-v2-core
description: Provides AWS SDK for Java 2.x client configuration, credential resolution, HTTP client tuning, timeout, retry, and testing patterns. Use when creating or hardening AWS service clients, wiring Spring Boot beans, debugging auth or region issues, or choosing sync vs async SDK usage.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
---

# AWS SDK for Java 2.x Core Patterns

## Overview

Use this skill to set up AWS SDK for Java 2.x clients with production-safe defaults.

It focuses on the decisions that matter most:
- how credentials and region are resolved
- how to configure sync and async HTTP clients
- how to apply timeouts, retries, lifecycle management, and tests

Keep `SKILL.md` focused on setup and delivery flow. Use the `references/` files for deeper API details and expanded examples.

## When to Use

- Creating or hardening AWS SDK for Java 2.x service clients
- Wiring Spring Boot beans for AWS integration
- Debugging auth, region, or credential issues
- Choosing between sync (`S3Client`, `DynamoDbClient`) and async (`S3AsyncClient`, `SqsAsyncClient`) clients

## Instructions

### 1. Select the service client type

- Sync clients (`S3Client`, `DynamoDbClient`) for request/response flows
- Async clients (`S3AsyncClient`, `SqsAsyncClient`) for concurrency, streaming, or backpressure
- Reuse one client per service and configuration profile

### 2. Configure credential and region resolution

Use `DefaultCredentialsProvider` with environment-aware defaults:
- local dev: shared AWS config, SSO, or environment variables
- CI/CD: web identity or injected environment variables
- AWS runtime: ECS task roles, EKS IRSA, or EC2 instance profiles

Override only for multi-account access, test isolation, or profile switching.

**Verify**: Call `StsClient.getCallerIdentity()` at startup to confirm credentials resolve.

### 3. Configure HTTP client, timeouts, and retries

Set production values explicitly:
- API call timeout and attempt timeout
- connection timeout and max connections or concurrency
- retry strategy aligned with service quotas and idempotency

Use ApacheHttpClient for sync and NettyNioAsyncHttpClient for async.

**Verify**: Confirm timeouts and retry behavior under failure conditions.

### 4. Wire clients as application-level dependencies

In Spring Boot:
- expose clients as `@Bean` singletons
- inject through constructors
- keep credential and region in configuration files

**Verify**: Check clients are not created inside hot execution paths.

Close custom HTTP clients and SDK clients during shutdown if lifecycle is not managed automatically.

### 5. Handle failures at integration boundaries

At the boundary layer:
- catch `SdkException` or service-specific exceptions
- distinguish retryable failures from auth, quota, and validation failures
- log request context, never secrets or raw credentials

### 6. Run integration tests before shipping

- verify region and caller identity in the target environment
- run tests against LocalStack, Testcontainers, or a sandbox account
- use `@PostConstruct` in Spring Boot configuration to fail fast on startup if credentials are missing

```java
StsClient stsClient = StsClient.builder().build();
GetCallerIdentityResponse identity = stsClient.getCallerIdentity();
// Logs: Successfully authenticated as: {identity.arn()}
```

## Examples

### Example 1: Spring Boot sync client with explicit HTTP and timeout settings

```java
@Configuration
public class AwsClientConfiguration {

    @Bean
    S3Client s3Client() {
        return S3Client.builder()
            .region(Region.of("eu-south-2"))
            .credentialsProvider(DefaultCredentialsProvider.create())
            .httpClientBuilder(ApacheHttpClient.builder()
                .maxConnections(100)
                .connectionTimeout(Duration.ofSeconds(3)))
            .overrideConfiguration(ClientOverrideConfiguration.builder()
                .apiCallAttemptTimeout(Duration.ofSeconds(10))
                .apiCallTimeout(Duration.ofSeconds(30))
                .build())
            .build();
    }
}
```

### Example 2: Async client for high-concurrency workloads

```java
SqsAsyncClient sqsAsyncClient = SqsAsyncClient.builder()
    .region(Region.US_EAST_1)
    .credentialsProvider(DefaultCredentialsProvider.create())
    .httpClientBuilder(NettyNioAsyncHttpClient.builder()
        .maxConcurrency(200)
        .connectionTimeout(Duration.ofSeconds(3))
        .readTimeout(Duration.ofSeconds(20)))
    .overrideConfiguration(ClientOverrideConfiguration.builder()
        .apiCallTimeout(Duration.ofSeconds(30))
        .build())
    .build();
```

## Best Practices

- Default to `DefaultCredentialsProvider` unless a project requirement says otherwise.
- Keep region selection explicit for server-side services.
- Reuse SDK clients instead of constructing them per request.
- Tune retries with service quotas and idempotency in mind.
- Put business mapping on top of the SDK, not inside controllers.
- Keep integration tests close to the configuration that creates the clients.
- Move deep service-specific examples to dedicated skills such as S3, DynamoDB, Bedrock, or Secrets Manager.

## Constraints and Warnings

- Do not embed access keys or session tokens in source code, examples, or configuration files.
- Static credentials are acceptable only for tightly scoped local tests.
- Missing region or invalid credential resolution often fails only at first call, so verify startup assumptions explicitly.
- Async clients require lifecycle management for the underlying HTTP resources.
- Excessive retries can amplify throttling and increase latency.
- Proxy, TLS, and metric publisher APIs can vary by chosen HTTP stack and SDK version; adapt examples to the versions already used by the project.

## References

- `references/api-reference.md`
- `references/best-practices.md`
- `references/developer-guide.md`

## Related Skills

- `aws-sdk-java-v2-secrets-manager`
- `aws-sdk-java-v2-s3`
- `aws-sdk-java-v2-dynamodb`
- `aws-sdk-java-v2-bedrock`

© giuseppe-trisciuoglio · MIT · giuseppe-trisciuoglio/developer-kit

Similar skills

All skills for Cloud: AWS, Azure, GCP →

From the same set96

aws-sdk-java-v2-kms This skill provides AWS KMS patterns for AWS SDK for Java 2.x, covering keys, encryption, data keys, signatures, and Spring Boot integration. CX Codex +1 3,700installs aws-sdk-java-v2-secrets-manager A skill for pulling AWS Secrets Manager values into Java services: retrieval, caching, rotation-aware access and Spring Boot wiring. CX Codex +1 3,700installs aws-sdk-java-v2-messaging Code patterns for AWS SQS and SNS using AWS SDK for Java 2.x. Helps configure clients, handle FIFO queues, set up DLQ, and integrate messaging into Spring Boot. CX Codex +1 3,700installs aws-sdk-java-v2-bedrock A skill that shows your agent how to call Amazon Bedrock models from AWS SDK for Java 2.x: text, images, embeddings and streaming. CX Codex +1 3,700installs nextjs-deployment Provides production deployment patterns for Next.js. Sets up multi-stage Dockerfiles, GitHub Actions workflows, health checks, and OpenTelemetry instrumentation. CX Codex +1 3,700installs aws-sdk-java-v2-lambda A skill that feeds your agent AWS Lambda patterns built on AWS SDK for Java 2.x. Useful when your Java service calls or deploys Lambda functions. CX Codex +1 3,700installs aws-rds-spring-boot-integration A skill that walks through wiring AWS RDS into Spring Boot: HikariCP pooling, SSL, IAM auth, Secrets Manager. CX Codex +1 3,700installs aws-sdk-java-v2-dynamodb Provides Amazon DynamoDB patterns using AWS SDK for Java 2.x and the Enhanced Client. Use it for type-safe CRUD, queries, transactions, and Spring Boot integration. CX Codex +1 3,700installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor