Skip to main content
skill CX Codex

aws-rds-spring-boot-integration — Claude Code skill for RDS

A skill that walks through wiring AWS RDS into Spring Boot: HikariCP pooling, SSL, IAM auth, Secrets Manager.

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

What aws-rds-spring-boot-integration does

The skill lays out the steps for configuring a datasource against AWS RDS in a Spring Boot app. It starts with dependencies: Spring Data JPA, a MySQL or PostgreSQL driver, and Flyway. Then connection properties in application.yml, HikariCP pool settings, SSL, separate dev and prod profiles, Flyway migration scripts, and a health check to confirm the database answers.

Three setups get full examples: Aurora MySQL, Aurora PostgreSQL with sslmode=require, and read/write splitting through a RoutingDataSource with writer and reader beans. Maven and Gradle snippets are included, along with environment variables and a sample V1__create_users_table.sql migration. The skill reads and edits files and runs commands through Read, Write, Edit, Bash, Glob and Grep.

When the connectivity check fails, the skill points at security group rules, credentials, network access to the RDS instance, and the SSL certificate. It also says to run migrations only after that check passes — worth following, since a failed flyway migrate against a half-configured pool is harder to debug. Pool size has to stay under the connection limit of your RDS instance.

What it helps with

  • size a HikariCP pool for an RDS workload
  • route reads to an Aurora replica and writes to the primary
  • switch from a hardcoded password to IAM database authentication
  • enable SSL with sslmode=require
  • set up Flyway migrations and verify the connection

Example prompts for the agent

  • Set up a Spring Boot datasource for Aurora PostgreSQL with SSL and HikariCP
  • Configure read/write splitting with a RoutingDataSource
  • Figure out why the health check can't reach my RDS database

How to install aws-rds-spring-boot-integration

1Skills CLI (Vercel)

npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-rds-spring-boot-integration -a claude-code

2Manually: put the files in place

~/.claude/skills/aws-rds-spring-boot-integration/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/aws-rds-spring-boot-integration/

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

Questions about aws-rds-spring-boot-integration

How do I install aws-rds-spring-boot-integration in Claude?

Run npx skills add giuseppe-trisciuoglio/developer-kit --skill aws-rds-spring-boot-integration -a claude-code. The skill file lands at ~/.claude/skills/aws-rds-spring-boot-integration/SKILL.md.

What does aws-rds-spring-boot-integration do?

It covers connecting AWS RDS to Spring Boot: dependencies, datasource properties, HikariCP pooling, SSL, environment profiles, Flyway migrations and a connectivity check.

Which databases does the skill cover?

Aurora, MySQL and PostgreSQL. For PostgreSQL the examples swap in org.postgresql.Driver, a jdbc:postgresql:// URL and org.hibernate.dialect.PostgreSQLDialect.

Source text

SKILL.md · MIT
---
name: aws-rds-spring-boot-integration
description: 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.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
---

# AWS RDS Spring Boot Integration

## Overview

Configure AWS RDS databases (Aurora, MySQL, PostgreSQL) with Spring Boot applications. Provides patterns for datasource configuration, HikariCP connection pooling, SSL connections, environment-specific configurations, and AWS Secrets Manager integration.

## When to Use

Use when configuring HikariCP connection pools for RDS workloads, implementing read/write split with Aurora replicas, setting up IAM database authentication, enabling SSL/TLS connections, managing database migrations with Flyway, or troubleshooting RDS connectivity issues.

## Instructions

Follow these steps to configure AWS RDS with Spring Boot:

1. **Add Dependencies** — Include Spring Data JPA, database driver (MySQL/PostgreSQL), and Flyway
2. **Configure Datasource** — Set connection properties in application.yml
3. **Configure HikariCP** — Optimize pool settings for your RDS workload
4. **Set Up SSL** — Enable encrypted connections to RDS
5. **Configure Profiles** — Set environment-specific configurations (dev/prod)
6. **Add Migrations** — Create Flyway scripts for schema management
7. **Validate Connectivity** — Run health check to verify database connection

   **If validation fails**: Check security group rules, verify credentials, ensure RDS is accessible from your network, and confirm SSL certificate configuration.

8. **Run Migrations** — Apply Flyway migrations only after connectivity validation passes

## Quick Start

### Step 1: Add Dependencies

**Maven (pom.xml):**
```xml
<dependencies>
    <!-- Spring Data JPA -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <!-- Aurora MySQL Driver -->
    <dependency>
        <groupId>com.mysql</groupId>
        <artifactId>mysql-connector-j</artifactId>
        <version>8.2.0</version>
        <scope>runtime</scope>
    </dependency>

    <!-- Aurora PostgreSQL Driver (alternative) -->
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>

    <!-- Flyway for database migrations -->
    <dependency>
        <groupId>org.flywaydb</groupId>
        <artifactId>flyway-core</artifactId>
    </dependency>

    <!-- Validation -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-validation</artifactId>
    </dependency>
</dependencies>
```

**Gradle (build.gradle):**
```gradle
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-validation'

    // Aurora MySQL
    runtimeOnly 'com.mysql:mysql-connector-j:8.2.0'

    // Aurora PostgreSQL (alternative)
    runtimeOnly 'org.postgresql:postgresql'

    // Flyway
    implementation 'org.flywaydb:flyway-core'
}
```

### Step 2: Basic Datasource Configuration

Use the configuration in the **Examples** section below. For PostgreSQL, change:
- Driver: `org.postgresql.Driver`
- URL: `jdbc:postgresql://...` with `?ssl=true&sslmode=require`
- Dialect: `org.hibernate.dialect.PostgreSQLDialect`

### Step 3: Set Up Environment Variables

```bash
# Production environment variables
export DB_PASSWORD=YourStrongPassword123!
export SPRING_PROFILES_ACTIVE=prod

# For development
export SPRING_PROFILES_ACTIVE=dev
```

## Database Migration Setup

Create migration files for Flyway:

```
src/main/resources/db/migration/
├── V1__create_users_table.sql
├── V2__add_phone_column.sql
└── V3__create_orders_table.sql
```

**V1__create_users_table.sql:**
```sql
CREATE TABLE users (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    email VARCHAR(255) NOT NULL UNIQUE,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_email (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

## Examples

### Example 1: Aurora MySQL Configuration

```yaml
spring:
  datasource:
    url: jdbc:mysql://myapp-aurora-cluster.cluster-abc123xyz.us-east-1.rds.amazonaws.com:3306/devops
    username: admin
    password: ${DB_PASSWORD}
    driver-class-name: com.mysql.cj.jdbc.Driver
    hikari:
      maximum-pool-size: 20
      minimum-idle: 5
      connection-timeout: 20000
  jpa:
    hibernate:
      ddl-auto: validate
    open-in-view: false
```

### Example 2: Aurora PostgreSQL with SSL

```properties
spring.datasource.url=jdbc:postgresql://myapp-aurora-pg-cluster.cluster-abc123xyz.us-east-1.rds.amazonaws.com:5432/devops?ssl=true&sslmode=require
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
spring.datasource.hikari.maximum-pool-size=30
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
```

### Example 3: Read/Write Split Configuration

```java
@Configuration
public class DataSourceConfiguration {

    @Bean
    @Primary
    public DataSource dataSource(
            @Qualifier("writerDataSource") DataSource writerDataSource,
            @Qualifier("readerDataSource") DataSource readerDataSource) {
        Map<Object, Object> targetDataSources = new HashMap<>();
        targetDataSources.put("writer", writerDataSource);
        targetDataSources.put("reader", readerDataSource);

        RoutingDataSource routingDataSource = new RoutingDataSource();
        routingDataSource.setTargetDataSources(targetDataSources);
        routingDataSource.setDefaultTargetDataSource(writerDataSource);

        return routingDataSource;
    }
}
```

## Constraints and Warnings

- HikariCP pool size must respect RDS instance connection limits
- Security groups must allow traffic from your application's IP range
- Use AWS Secrets Manager instead of hardcoding credentials
- Enable storage autoscaling to prevent storage exhaustion

## Best Practices

- **HikariCP**: Enable leak detection and configure timeouts for failover scenarios
- **Security**: Enable SSL/TLS; use IAM Database Authentication when possible
- **Performance**: Disable open-in-view; use appropriate indexing and batch operations
- **Monitoring**: Enable Spring Boot Actuator with database health checks

## Testing

Verify connectivity with this health check endpoint:

```java
@RestController
@RequestMapping("/api/health")
public class DatabaseHealthController {
    @Autowired
    private DataSource dataSource;

    @GetMapping("/db-connection")
    public ResponseEntity<Map<String, Object>> testDatabaseConnection() {
        Map<String, Object> response = new HashMap<>();
        try (Connection connection = dataSource.getConnection()) {
            response.put("status", "success");
            response.put("database", connection.getCatalog());
            response.put("connected", true);
            return ResponseEntity.ok(response);
        } catch (Exception e) {
            response.put("status", "failed");
            response.put("error", e.getMessage());
            response.put("connected", false);
            return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(response);
        }
    }
}
```

```bash
curl http://localhost:8080/api/health/db-connection
```

## Support

For detailed troubleshooting and advanced configuration, refer to:

- [AWS RDS Aurora Advanced Configuration](references/advanced-configuration.md)
- [AWS RDS Aurora Troubleshooting Guide](references/troubleshooting.md)
- [AWS RDS Aurora documentation](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/java_aurora_code_examples.html)
- [Spring Boot Data RDS Aurora documentation](https://www.baeldung.com/aws-aurora-rds-java)

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

Similar skills

Everything for Cloud: AWS, Azure, GCP →

From the same set93

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-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 langchain4j-testing-strategies Guides Java tests for LangChain4j, from mocked ChatModel responses to RAG workflows and Testcontainers-based integration checks. CX Codex +1 3,700installs aws-sdk-java-v2-s3 Hands your agent ready-made Amazon S3 patterns for AWS SDK for Java 2.x: buckets, object uploads, multipart, presigned URLs. CX Codex +1 3,700installs langchain4j-mcp-server-patterns Provides design patterns for building Java MCP servers and connecting them to LangChain4j. Useful when exposing tools in Spring Boot and securing agent execution. 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