Community编程与开发github.com

AWS SDK for Java v2 核心库

提供AWS SDK for Java 2.x的客户端配置、凭证解析、HTTP客户端调优、超时、重试和测试模式。适用于创建或强化AWS服务客户端、组装Spring Boot Bean、调试认证或区域问题,以及选择同步或异步SDK用法。

AWS SDK for Java v2 核心库 是什么?

该技能为开发者提供AWS SDK for Java 2.x的全面配置和管理能力。它涵盖了客户端配置(如区域、端点覆盖和双栈模式)、凭证解析(支持默认凭证链、STS角色切换和凭证缓存)、HTTP客户端调优(包括连接池大小、空闲连接超时和TLS设置)、超时与重试策略(如请求超时、指数退避和重试模式选择),以及同步与异步客户端的选择依据。此外,还包括测试与本地开发支持(模拟HTTP后端、内存测试和本地Stack端点),并可与Spring Boot无缝集成,利用环境变量或属性源进行配置。该技能支持所有主要的AWS服务(如S3、DynamoDB、SQS、Lambda和ECS/EKS),并适用于在Spring Boot中创建或强化AWS服务客户端、调试认证或区域问题,以及选择合适的SDK用法。它涵盖了AWS SDK for Java v2的核心构建块,包括AWS配置文件匹配和Credentials Provider选择。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit/tree/main/skills/aws-sdk-java-v2-core

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

AWS SDK for Java v2 核心库 是做什么的?

提供AWS SDK for Java 2.x的客户端配置、凭证解析、HTTP客户端调优、超时、重试和测试模式。适用于创建或强化AWS服务客户端、组装Spring Boot Bean、调试认证或区域问题,以及选择同步或异步SDK用法。

概述

此技能涵盖了使用AWS SDK for Java v2构建稳定且高效的AWS服务客户端所需的核心模式,包括:

  • 客户端配置(区域、端点覆盖、双栈模式)
  • 凭证解析(默认凭证链、STS角色切换、凭证缓存)
  • HTTP客户端调优(连接池大小、空闲连接超时、TLS设置)
  • 超时与重试策略(请求超时、指数退避、重试模式选择)
  • 同步与异步客户端的选择依据
  • 测试与本地开发支持(模拟HTTP后端、内存测试、本地Stack端点)
  • Spring Boot集成(通过环境变量或属性源进行配置)

支持的服务

  • 存储:S3、S3 Glacier
  • 数据库:DynamoDB、RDS、Aurora
  • 消息队列:SQS、SNS、EventBridge
  • 计算:Lambda、ECS、EKS、EC2
  • 监控:CloudWatch、X-Ray
  • 安全:IAM、KMS、Secrets Manager
  • 无服务器:API Gateway、Step Functions

核心构建块

AWS配置文件匹配

使用标准 ~/.aws/config 配置文件:

[profile my-profile]
region = eu-west-1
output = json
role_arn = arn:aws:iam::123456789012:role/my-role
source_profile = default

Credentials Provider选择

使用默认凭证链:

StaticCredentialsProvider.create(
    AwsBasicCredentials.create("accessKey", "secretKey")
)

或使用STS角色切换:

StsAssumeRoleCredentialsProvider.builder()
    .stsClient(stsClient)
    .refreshRequest(() -> AssumeRoleRequest.builder()
        .roleArn("arn:aws:iam::123456789012:role/my-role")
        .roleSessionName("my-session")
        .build())
    .build()

用法

基本设置

S3Client client = S3Client.builder()
    .region(Region.EU_WEST_1)
    .credentialsProvider(DefaultCredentialsProvider.create())
    .httpClient(ApacheHttpClient.builder()
        .maxConnections(100)
        .connectionTimeout(Duration.ofSeconds(5))
        .build())
    .overrideConfiguration(c -> c
        .apiCallTimeout(Duration.ofSeconds(30))
        .retryPolicy(RetryPolicy.builder()
            .numRetries(3)
            .build()))
    .build();

Spring Boot配置

aws:
  region: eu-west-1
  credentials:
    access-key: ${AWS_ACCESS_KEY_ID}
    secret-key: ${AWS_SECRET_ACCESS_KEY}
  http:
    max-connections: 100
    connection-timeout: 5000
  retry:
    mode: adaptive
    max-attempts: 3

故障排查

  • 凭证错误:检查 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY 环境变量
  • 区域错误:使用 aws:region 属性或 AWS_REGION 环境变量
  • 连接错误:使用 connectionTimeout 和 readTimeout 设置
  • 重试耗尽:调整 numRetries 和 backoffStrategy
  • 速率限制:实现指数退避或使用自适应重试模式

安全考虑

  • 不要硬编码凭证,使用环境变量或 DefaultCredentialsProvider
  • 使用TLS 1.2及以上版本进行安全通信
  • 启用加密(S3、DynamoDB等)
  • 使用IAM角色分配最小权限
  • 审计日志记录API调用用于跟踪

性能优化

  • 连接复用:使用连接池(默认:50个连接)
  • 请求批处理:使用SQS或DynamoDB批处理操作
  • 异步处理:使用异步客户端提高并发性
  • 缓存:在适用时缓存凭证和区域元数据
  • 压缩:对大型负载使用gzip压缩
  • 监控指标:使用CloudWatch监控请求延迟和错误率

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

giuseppe-trisciuoglio/aws-lambda-java-integration

Provides AWS Lambda integration patterns for Java with cold start optimization. Use when deploying Java functions to AWS Lambda, choosing between Micronaut and Raw Java approaches, optimizing cold starts below 1 second, configuring API Gateway or ALB integration, or implementing serverless Java applications. Triggers include "create lambda java", "deploy java lambda", "micronaut lambda aws", "java lambda cold start", "aws lambda java performance", "java serverless framework".

giuseppe-trisciuoglio/aws-lambda-php-integration

Provides AWS Lambda integration patterns for PHP with Symfony using the Bref framework. Creates Lambda handler classes, configures runtime layers, sets up SQS/SNS event triggers, implements warm-up strategies, and optimizes cold starts. Use when deploying PHP/Symfony applications to AWS Lambda, configuring API Gateway integration, implementing serverless PHP applications, or optimizing Lambda performance with Bref. Triggers include "create lambda php", "deploy symfony lambda", "bref lambda aws", "php lambda cold start", "aws lambda php performance", "symfony serverless", "php serverless framework".

giuseppe-trisciuoglio/aws-lambda-python-integration

Provides AWS Lambda integration patterns for Python with cold start optimization. Use when deploying Python functions to AWS Lambda, choosing between AWS Chalice and raw Python approaches, optimizing cold starts, configuring API Gateway or ALB integration, or implementing serverless Python applications. Triggers include "create lambda python", "deploy python lambda", "chalice lambda aws", "python lambda cold start", "aws lambda python performance", "python serverless framework".

giuseppe-trisciuoglio/aws-lambda-typescript-integration

Provides AWS Lambda integration patterns for TypeScript with cold start optimization. Use when creating or deploying TypeScript Lambda functions, choosing between NestJS framework and raw TypeScript approaches, optimizing cold starts, configuring API Gateway or ALB integration, or implementing serverless TypeScript applications. Triggers include "create lambda typescript", "deploy typescript lambda", "nestjs lambda aws", "raw typescript lambda", "aws lambda typescript performance".

giuseppe-trisciuoglio/aws-rds-spring-boot-integration

Provides patterns to configure AWS RDS (Aurora, MySQL, PostgreSQL) with Spring Boot applications. Configures HikariCP connection pools, implements read/write splitting, sets up IAM database authentication, enables SSL connections, and integrates with AWS Secrets Manager. Use when setting up RDS connections in Spring Boot, configuring connection pooling, or managing database credentials securely.

giuseppe-trisciuoglio/aws-sdk-java-v2-bedrock

Provides Amazon Bedrock patterns using AWS SDK for Java 2.x. Invokes foundation models (Claude, Llama, Titan), generates text and images, creates embeddings for RAG, streams real-time responses, and configures Spring Boot integration. Use when asking about Bedrock integration, Java SDK for AI models, AWS generative AI, Claude/Llama invocation, embeddings for RAG, or Spring Boot AI setup.

giuseppe-trisciuoglio/aws-sdk-java-v2-dynamodb

Provides Amazon DynamoDB patterns using AWS SDK for Java 2.x. Use when creating, querying, scanning, or performing CRUD operations on DynamoDB tables, working with indexes, batch operations, transactions, or integrating with Spring Boot applications.

giuseppe-trisciuoglio/aws-sdk-java-v2-kms

Provides AWS Key Management Service (KMS) patterns using AWS SDK for Java 2.x. Use when creating/managing encryption keys, encrypting/decrypting data, generating data keys, digital signing, key rotation, or integrating encryption into Spring Boot applications.

giuseppe-trisciuoglio/aws-sdk-java-v2-lambda

Provides AWS Lambda patterns using AWS SDK for Java 2.x. Use when invoking Lambda functions, creating/updating functions, managing function configurations, working with Lambda layers, or integrating Lambda with Spring Boot applications.

giuseppe-trisciuoglio/aws-sdk-java-v2-messaging

Provides AWS messaging patterns using AWS SDK for Java 2.x for SQS queues and SNS topics. Handles sending/receiving messages, FIFO queues, DLQ, subscriptions, and pub/sub patterns. Use when implementing messaging with SQS or SNS.

giuseppe-trisciuoglio/aws-sdk-java-v2-rds

Provides AWS RDS (Relational Database Service) management patterns using AWS SDK for Java 2.x. Use when creating, modifying, monitoring, or managing Amazon RDS database instances, snapshots, parameter groups, and configurations.

giuseppe-trisciuoglio/aws-sdk-java-v2-s3

Provides Amazon S3 patterns and examples using AWS SDK for Java 2.x. Use when working with S3 buckets, uploading/downloading objects, multipart uploads, presigned URLs, S3 Transfer Manager, object operations, or S3-specific configurations.

giuseppe-trisciuoglio/aws-sdk-java-v2-secrets-manager

Provides AWS Secrets Manager patterns for AWS SDK for Java 2.x, including secret retrieval, caching, rotation-aware access, and Spring Boot integration. Use when storing or reading secrets in Java services, replacing hardcoded credentials, or wiring secret-backed configuration into applications.

giuseppe-trisciuoglio/better-auth

Provides Better Auth integration patterns for NestJS backend and Next.js frontend with Drizzle ORM and PostgreSQL. Use when setting up Better Auth with NestJS backend, integrating Next.js App Router frontend, configuring Drizzle ORM schema, implementing social login (GitHub, Google), adding plugins (2FA, Organization, SSO, Magic Link, Passkey), implementing email/password authentication with session management, or creating protected routes and middleware.

giuseppe-trisciuoglio/chunking-strategy

Provides chunking strategies for RAG systems. Generates chunk size recommendations (256-1024 tokens), overlap percentages (10-20%), and semantic boundary detection methods. Validates semantic coherence and evaluates retrieval precision/recall metrics. Use when building retrieval-augmented generation systems, vector databases, or processing large documents.

giuseppe-trisciuoglio/clean-architecture

Provides implementation patterns for Clean Architecture, Hexagonal Architecture (Ports & Adapters), and Domain-Driven Design in Java 21+ Spring Boot 3.5+ applications. Use when structuring layered architectures, separating domain logic from frameworks, implementing ports and adapters, creating entities/value objects/aggregates, or refactoring monolithic codebases for testability and maintainability.

giuseppe-trisciuoglio/docs-updater

Provides automated documentation updates by analyzing git changes between the current branch and the last release tag. Performs git diff analysis to identify modifications, then updates README.md, CHANGELOG.md following Keep a Changelog standard, and discovers documentation folders for contextual updates. Use when preparing a release, maintaining documentation sync, or before creating a pull request. Triggers on "update docs", "update changelog", "sync documentation", "update readme", "prepare release documentation".

giuseppe-trisciuoglio/drawio-logical-diagrams

Creates professional logical flow diagrams and logical system architecture diagrams using draw.io XML format (.drawio files). Use when creating: (1) logical flow diagrams showing data/process flow between system components, (2) logical architecture diagrams representing system structure without cloud provider specifics, (3) BPMN process diagrams, (4) UML diagrams (class, sequence, activity), (5) data flow diagrams (DFD), (6) decision flowcharts, or (7) system interaction diagrams. This skill focuses on generic/abstract representations, not AWS/Azure-specific architectures (use aws-drawio-architecture-diagrams for cloud diagrams).

giuseppe-trisciuoglio/drizzle-orm-patterns

Provides comprehensive Drizzle ORM patterns for schema definition, CRUD operations, relations, queries, transactions, and migrations. Proactively use for any Drizzle ORM development including defining database schemas, writing type-safe queries, implementing relations, managing transactions, and setting up migrations with Drizzle Kit. Supports PostgreSQL, MySQL, SQLite, MSSQL, and CockroachDB.

giuseppe-trisciuoglio/github-issue-workflow

Provides a structured 8-phase workflow for resolving GitHub issues in Claude Code. Covers fetching issue details, analyzing requirements, implementing solutions, verifying correctness, performing code review, committing changes, and creating pull requests. Use when user asks to resolve, implement, work on, fix, or close a GitHub issue, or references an issue URL or number for implementation.

相关技能