aws-sdk-java-v2-rds
giuseppe-trisciuoglio/developer-kit
AWS RDS management patterns using AWS SDK for Java 2.x
What is aws-sdk-java-v2-rds?
Provides comprehensive guidance for creating, modifying, monitoring, and managing Amazon RDS database instances, snapshots, parameter groups, and configurations using the AWS SDK for Java 2.x. Use when you need to automate RDS operations, set up databases programmatically, or integrate RDS with Lambda and Spring Boot applications.
- Create and configure RDS database instances with security settings
- Manage DB snapshots, parameter groups, and instance modifications
- Monitor instance status and perform failover operations
- Set up Multi-AZ deployments and automated backups
- Integrate RDS with Spring Boot and Lambda functions
- Handle deletion protection and encryption configuration
How to install aws-sdk-java-v2-rds
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill aws-sdk-java-v2-rds- AWS SDK for Java 2.x (rds artifact version 2.20.0+)
- Database driver (e.g., PostgreSQL JDBC driver)
- AWS credentials configured with appropriate RDS permissions
- Java 8 or later
How to use aws-sdk-java-v2-rds
- 1.Add AWS RDS SDK and database driver dependencies to your project
- 2.Create an RdsClient instance with region and credentials configuration
- 3.Use RdsClient methods like createDBInstance() to provision databases
- 4.Configure security settings including VPC security groups and encryption
- 5.Set up automated backups and Multi-AZ for production workloads
- 6.Monitor instance status using describeDBInstances() and waiters
- 7.Create snapshots before major changes using createDBSnapshot()
- 8.Close the client using try-with-resources to ensure proper cleanup
Use cases
- Automating database instance provisioning in infrastructure-as-code pipelines
- Creating snapshots before major database changes
- Configuring high-availability Multi-AZ deployments programmatically
- Connecting Lambda functions to RDS databases with credential management
- Monitoring and modifying RDS instances based on application requirements
- Java backend developers
- DevOps engineers managing AWS infrastructure
- Cloud architects designing RDS deployments
- Lambda function developers needing database access
aws-sdk-java-v2-rds FAQ
Use the RdsClient waiter: rdsClient.waiter().waitUntilDBInstanceAvailable(DescribeDbInstancesRequest.builder().dbInstanceIdentifier(instanceId).build()). This blocks until the instance reaches 'available' status.
Enable storageEncrypted=true, use VPC security groups, set publiclyAccessible=false, enable Multi-AZ for high availability, enable deletionProtection=true, and configure automated backups with 7+ day retention.
Yes, the skill includes Spring Boot integration patterns in references/spring-boot-integration.md covering bean configuration, service layer implementation, and REST controller design.
The skill references lambda-integration.md which covers using AWS Secrets Manager for credential management and connection pooling best practices.
Resource leaks may occur. Always close the client using try-with-resources: try (RdsClient client = RdsClient.builder()...build()) { ... }
Full instructions (SKILL.md)
Source of truth, from giuseppe-trisciuoglio/developer-kit.
name: aws-sdk-java-v2-rds description: 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. allowed-tools: Read, Write, Edit, Bash, Glob, Grep
AWS SDK for Java v2 - RDS Management
Overview
This skill provides comprehensive guidance for working with Amazon RDS (Relational Database Service) using the AWS SDK for Java 2.x, covering database instance management, snapshots, parameter groups, and RDS operations.
When to Use
- Creating, modifying, or deleting RDS database instances
- Managing DB snapshots, parameter groups, and configurations
- Setting up Multi-AZ deployments and automated backups
- Connecting Lambda functions to RDS databases
- Monitoring instance status and performance
Instructions
Follow these steps to work with Amazon RDS:
- Add Dependencies - Include AWS RDS SDK dependency and database drivers
- Create RDS Client - Instantiate RdsClient with proper region and credentials
- Create DB Instance - Use createDBInstance() with appropriate configuration
- Configure Security - Set up VPC security groups and encryption
- Set Up Backups - Configure automated backup windows and retention
- Monitor Status - Use describeDBInstances() to check instance state
- Create Snapshots - Take manual snapshots before major changes
- Handle Failover - Configure Multi-AZ for high availability
Getting Started
RDS Client Setup
The RdsClient is the main entry point for interacting with Amazon RDS.
Basic Client Creation:
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.rds.RdsClient;
RdsClient rdsClient = RdsClient.builder()
.region(Region.US_EAST_1)
.build();
// Use client
describeInstances(rdsClient);
// Always close the client
rdsClient.close();
Client with Custom Configuration:
import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
import software.amazon.awssdk.http.apache.ApacheHttpClient;
RdsClient rdsClient = RdsClient.builder()
.region(Region.US_WEST_2)
.credentialsProvider(ProfileCredentialsProvider.create("myprofile"))
.httpClient(ApacheHttpClient.builder()
.connectionTimeout(Duration.ofSeconds(30))
.socketTimeout(Duration.ofSeconds(60))
.build())
.build();
Describing DB Instances
DescribeDbInstancesResponse response = rdsClient.describeDBInstances();
for (DBInstance instance : response.dbInstances()) {
System.out.println(instance.dbInstanceArn() + " - " + instance.dbInstanceStatus());
}
Key Operations
Creating DB Instances
CreateDbInstanceRequest request = CreateDbInstanceRequest.builder()
.dbInstanceIdentifier(dbInstanceIdentifier)
.dbName(dbName)
.engine("postgres")
.engineVersion("15.4")
.dbInstanceClass("db.t3.micro")
.allocatedStorage(20)
.masterUsername(masterUsername)
.masterUserPassword(masterPassword)
.publiclyAccessible(false)
.build();
CreateDbInstanceResponse response = rdsClient.createDBInstance(request);
// VALIDATION CHECKPOINT: Wait for instance to be available
rdsClient.waiter().waitUntilDBInstanceAvailable(
DescribeDbInstancesRequest.builder().dbInstanceIdentifier(dbInstanceIdentifier).build()
);
System.out.println("Instance " + dbInstanceIdentifier + " is available!");
Managing DB Parameter Groups
CreateDbParameterGroupRequest request = CreateDbParameterGroupRequest.builder()
.dbParameterGroupName(groupName)
.dbParameterGroupFamily("postgres15")
.description(description)
.build();
rdsClient.createDBParameterGroup(request);
Managing DB Snapshots
CreateDbSnapshotRequest request = CreateDbSnapshotRequest.builder()
.dbInstanceIdentifier(dbInstanceIdentifier)
.dbSnapshotIdentifier(snapshotIdentifier)
.build();
CreateDbSnapshotResponse response = rdsClient.createDBSnapshot(request);
Integration Patterns
Spring Boot Integration
Refer to references/spring-boot-integration.md for complete Spring Boot integration examples including:
- Spring Boot configuration with application properties
- RDS client bean configuration
- Service layer implementation
- REST controller design
- Exception handling
- Testing strategies
Lambda Integration
Refer to references/lambda-integration.md for Lambda integration examples including:
- Traditional Lambda + RDS connections
- Lambda with connection pooling
- Using AWS Secrets Manager for credentials
- Lambda with AWS SDK for RDS management
- Security configuration and best practices
Advanced Operations
Modifying DB Instances
ModifyDbInstanceRequest request = ModifyDbInstanceRequest.builder()
.dbInstanceIdentifier(dbInstanceIdentifier)
.dbInstanceClass(newInstanceClass)
.applyImmediately(false)
.build();
rdsClient.modifyDBInstance(request);
Deleting DB Instances
// VALIDATION CHECKPOINT: Verify instance exists and check status
DBInstance instance = rdsClient.describeDBInstances(
DescribeDbInstancesRequest.builder().dbInstanceIdentifier(dbInstanceIdentifier).build()
).dbInstances().get(0);
if ("available".equals(instance.dbInstanceStatus())) {
DeleteDbInstanceRequest request = DeleteDbInstanceRequest.builder()
.dbInstanceIdentifier(dbInstanceIdentifier)
.skipFinalSnapshot(false)
.finalDBSnapshotIdentifier(snapshotId)
.build();
rdsClient.deleteDBInstance(request);
}
Examples
Complete RDS Instance Creation with Validation
public String createSecurePostgreSQLInstance(RdsClient rdsClient,
String instanceIdentifier,
String dbName,
String masterUsername,
String masterPassword,
String vpcSecurityGroupId) {
// Create instance with security settings
CreateDbInstanceRequest request = CreateDbInstanceRequest.builder()
.dbInstanceIdentifier(instanceIdentifier)
.dbName(dbName)
.masterUsername(masterUsername)
.masterUserPassword(masterPassword)
.engine("postgres")
.engineVersion("15.4")
.dbInstanceClass("db.t3.micro")
.allocatedStorage(20)
.storageEncrypted(true)
.vpcSecurityGroupIds(vpcSecurityGroupId)
.publiclyAccessible(false)
.multiAZ(true)
.backupRetentionPeriod(7)
.deletionProtection(true)
.build();
rdsClient.createDBInstance(request);
// VALIDATION: Wait for instance availability
rdsClient.waiter().waitUntilDBInstanceAvailable(
DescribeDbInstancesRequest.builder().dbInstanceIdentifier(instanceIdentifier).build()
);
System.out.println("Instance " + instanceIdentifier + " is available!");
return instanceIdentifier;
}
Best Practices
Security: Enable encryption (storageEncrypted=true), use VPC security groups, disable public access.
High Availability: Enable Multi-AZ for production workloads.
Backups: Configure automated backups with 7+ day retention.
Deletion Protection: Enable deletionProtection(true) for production databases.
Resource Management: Always close clients with try-with-resources:
try (RdsClient rdsClient = RdsClient.builder().region(Region.US_EAST_1).build()) {
// Use client
}
Dependencies
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>rds</artifactId>
<version>2.20.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
</dependency>
Reference Documentation
For detailed API reference, see:
- API Reference - Complete API documentation and data models
- Spring Boot Integration - Spring Boot patterns and examples
- Lambda Integration - Lambda function patterns and best practices
Error Handling
See API Reference for comprehensive error handling patterns including common exceptions, error response structure, and pagination support.
Constraints and Warnings
- Instance Limits: Account limits on DB instances per region
- Multi-AZ Costs: Approximately doubles compute costs
- Snapshot Costs: Manual snapshots billed per storage used
- Deletion Protection: Cannot delete instances with protection enabled
- Maintenance Windows: Instances may be unavailable during updates
Related skills
More from giuseppe-trisciuoglio/developer-kit and the wider catalog.

aws-sdk-java-v2-s3
AWS SDK for Java 2.x patterns for S3 bucket management, uploads, downloads, and multipart transfers.

aws-sdk-java-v2-secrets-manager
Retrieve, cache, and rotate AWS Secrets Manager credentials in Java 2.x applications with Spring Boot integration.

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.

bug-fix-brief
Generates a structured Bug Fix Brief (BFB) to document issue corrections. Includes root cause analysis, repro steps, fix options, and fix checklist. Use when user asks to create a BFB, document a bug fix, or generate a bug correction document.

chunking-strategy
Optimize document chunking for RAG systems with size, overlap, and semantic boundary recommendations.

clean-architecture
Clean Architecture, Hexagonal Architecture, and DDD patterns for Spring Boot 3.5+ applications.