aws-sdk-java-v2-core — скилл для AWS Java SDK
Помогает настроить клиенты AWS SDK для Java 2.x: креды, регион, HTTP-стек, таймауты и ретраи. Пригодится, когда клиент падает на первом вызове или нужен Spring Boot бин.
npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a claude-codeЧто делает aws-sdk-java-v2-core
Скилл задаёт порядок сборки клиента: сначала выбираете синхронный (S3Client, DynamoDbClient) или асинхронный (S3AsyncClient, SqsAsyncClient) вариант, потом настраиваете разрешение кредов и региона, затем HTTP-клиент и лимиты. Для синхронных советует ApacheHttpClient, для асинхронных — NettyNioAsyncHttpClient. Конкретные значения таймаутов и соединений берутся из требований сервиса, готовых цифр скилл не навязывает.
По кредам по умолчанию ставит DefaultCredentialsProvider: локально это shared config, SSO или переменные окружения, в CI — web identity, в AWS — роли задач ECS, IRSA в EKS или instance profiles. Проверить, что всё разрешилось, предлагает вызовом StsClient.getCallerIdentity() на старте. Это важный шаг, потому что неверный регион или креды часто всплывают только на первом реальном запросе. В Spring Boot клиенты выносятся в @Bean-синглтоны и внедряются через конструктор, чтобы не создавать их в горячем пути.
Внутри есть раздел про обработку ошибок на границе интеграции: ловить SdkException, отличать ретраи от проблем с доступом и квотами, не писать в логи секреты. Для тестов — LocalStack, Testcontainers или песочный аккаунт, а @PostConstruct позволяет упасть сразу при старте, если кредов нет. Ключи и токены в исходниках держать нельзя; статические креды допустимы только для узких локальных тестов. Скилл намеренно не разбирает S3, DynamoDB и Bedrock — для них есть отдельные скиллы.
Какие задачи решает
- собрать S3-клиент с явными таймаутами и пулом соединений
- выяснить, почему клиент падает на первом вызове из-за региона или кредов
- вынести AWS-клиенты в Spring Boot бины и не плодить их на каждый запрос
- выбрать синхронный или асинхронный клиент под нагрузку
- проверить креды на старте через
getCallerIdentity
Примеры запросов агенту
- Настрой
S3Clientдля региона eu-south-2 сApacheHttpClientи таймаутами 10 и 30 секунд - Переведи наш
SqsAsyncClientнаNettyNioAsyncHttpClientс конкурентностью 200 - Добавь в Spring Boot конфигурацию проверку кредов через
StsClient.getCallerIdentity()при старте
Как установить aws-sdk-java-v2-core
1Через Skills CLI (Vercel)
npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a claude-code2Вручную: положить файлы
~/.claude/skills/aws-sdk-java-v2-core/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/aws-sdk-java-v2-core/
1Через Skills CLI (Vercel)
npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a codex2Вручную: положить файлы
.agents/skills/aws-sdk-java-v2-core/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a cursor2Вручную: положить файлы
.cursor/skills/aws-sdk-java-v2-core/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install giuseppe-trisciuoglio/developer-kit aws-sdk-java-v2-core2Вручную: положить файлы
.github/skills/aws-sdk-java-v2-core/SKILL.md1Через Skills CLI (Vercel)
npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a gemini-cli2Командой платформы
gemini skills install https://github.com/giuseppe-trisciuoglio/developer-kit --path plugins/developer-kit-java/skills/aws-sdk-java-v2-coreВручную: положить файлы
.devin/skills/aws-sdk-java-v2-core/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о aws-sdk-java-v2-core
Как установить aws-sdk-java-v2-core в Claude Code?
Выполните npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-core -a claude-code, после чего скилл окажется в ~/.claude/skills/aws-sdk-java-v2-core/SKILL.md.
Что делает aws-sdk-java-v2-core?
Описывает настройку клиентов AWS SDK для Java 2.x: разрешение кредов и региона, HTTP-стек, таймауты, ретраи, жизненный цикл и тесты. Помогает собрать клиент с безопасными для продакшена настройками.
Какие HTTP-клиенты используются для синхронных и асинхронных вызовов?
Для синхронных — ApacheHttpClient, для асинхронных — NettyNioAsyncHttpClient. Параметры прокси, TLS и публикации метрик зависят от выбранного стека и версии SDK, поэтому примеры нужно подгонять под проект.
Исходный текст
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