AWS Advanced Drivers

Documentation for AWS Advanced JDBC, Python, Node.js, Go, .NET, and ODBC Drivers

AWS Advanced JDBC Wrapper

← Back to Home

The AWS Advanced JDBC Wrapper is a JDBC driver wrapper that provides advanced features for Java applications connecting to Amazon Aurora and RDS databases.

Latest Version: 2.6.6
Repository: github.com/aws/aws-advanced-jdbc-wrapper

Installation

Add the dependency to your project:

Maven:

<dependency>
    <groupId>software.amazon.jdbc</groupId>
    <artifactId>aws-advanced-jdbc-wrapper</artifactId>
    <version>2.6.6</version>
</dependency>

Gradle:

implementation 'software.amazon.jdbc:aws-advanced-jdbc-wrapper:2.6.6'

Quick Start

import software.amazon.jdbc.Driver;
import java.sql.*;

String url = "jdbc:aws-wrapper:postgresql://db-instance.cluster-xyz.us-east-1.rds.amazonaws.com:5432/mydb";
Properties props = new Properties();
props.setProperty("user", "username");
props.setProperty("password", "password");

try (Connection conn = DriverManager.getConnection(url, props)) {
    // Use connection
}

Key Features

Configuration

Enable plugins via connection properties:

props.setProperty("wrapperPlugins", "failover,iam,secretsManager");

Common Configurations

Basic Failover

Properties props = new Properties();
props.setProperty("wrapperPlugins", "failover");
props.setProperty("user", "username");
props.setProperty("password", "password");

String url = "jdbc:aws-wrapper:postgresql://cluster.region.rds.amazonaws.com:5432/mydb";
Connection conn = DriverManager.getConnection(url, props);

IAM Authentication

Properties props = new Properties();
props.setProperty("wrapperPlugins", "failover,iam");
props.setProperty("user", "iamuser");

String url = "jdbc:aws-wrapper:postgresql://cluster.region.rds.amazonaws.com:5432/mydb";
Connection conn = DriverManager.getConnection(url, props);

Secrets Manager

Properties props = new Properties();
props.setProperty("wrapperPlugins", "failover,secretsManager");
props.setProperty("secretId", "arn:aws:secretsmanager:region:account:secret:name");

String url = "jdbc:aws-wrapper:postgresql://cluster.region.rds.amazonaws.com:5432/mydb";
Connection conn = DriverManager.getConnection(url, props);

Read/Write Splitting

Properties props = new Properties();
props.setProperty("wrapperPlugins", "failover,readWriteSplitting");
props.setProperty("user", "username");
props.setProperty("password", "password");

String url = "jdbc:aws-wrapper:postgresql://cluster.region.rds.amazonaws.com:5432/mydb";
Connection conn = DriverManager.getConnection(url, props);

// Reads go to reader instances
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM users");

// Writes go to writer instance
conn.createStatement().executeUpdate("INSERT INTO users VALUES (...)");

Supported Drivers

Resources