- Notifications
You must be signed in to change notification settings - Fork73
The Amazon Web Services JDBC Driver has been redesigned as an advanced JDBC wrapper. This wrapper is complementary to and extends the functionality of an existing JDBC driver to help an application take advantage of the features of clustered databases such as Amazon Aurora.
License
aws/aws-advanced-jdbc-wrapper
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
TheAmazon Web Services (AWS) JDBC Driver has been redesigned as an advanced JDBC wrapper.
The wrapper is complementary to an existing JDBC driver and aims to extend the functionality of the driver to enable applications to take full advantage of the features of clustered databases such as Amazon Aurora. In other words, the AWS JDBC Driver does not connect directly to any database, but enables support of AWS and Aurora functionalities on top of an underlying JDBC driver of the user's choice. This approach enables service-specific enhancements, without requiring users to change their workflow and existing JDBC driver tooling.
The AWS JDBC Driver is targeted to work withany existing JDBC driver. Currently, the AWS JDBC Driver has been validated to support thePostgreSQL JDBC Driver,MySQL JDBC Driver, andMariaDB JDBC Driver.
The AWS JDBC Driver provides modular functionality through feature plugins, with each plugin being relevant to specific database services based on their architecture and capabilities. For example,AWS Identity and Access Management (IAM) authentication is supported across multiple services, whileAWS Secrets Manager applies to services that support password-based authentication. The fast failover plugin provides reduced recovery time during failover for Aurora PostgreSQL and Aurora MySQL clusters.
Built-in support for AWS Identity and Access Management (IAM) authentication eliminates the need to manage database passwords, while AWS Secrets Manager integration provides secure credential management for services that require password-based authentication.
The wrapper design allows developers to continue using their preferred JDBC drivers and existing database code while gaining service-specific enhancements. No application rewrites are required.
The plugin-based design ensures applications only load the functionality they need, reducing dependencies and overhead.
For Aurora PostgreSQL, Aurora MySQL, and RDS Multi-AZ DB clusters, the driver significantly reduces connection recovery time duringdatabase failovers. By maintaining a real-time cache of cluster topology and bypassing DNS resolution delays, applications can reconnect to healthy database instances in seconds rather than minutes.
The driver includes Enhanced Failure Monitoring (EFM) that proactively monitors database node health, detecting failures faster than traditional timeout-based approaches. This allows applications to respond to issues before they impact end users.
The AWS JDBC Driver provides fast failover capabilities for Aurora PostgreSQL and Aurora MySQL clusters, significantly reducing connection recovery time during database failovers.
Visitthis page for more details.
TheAWS RDS Multi-AZ DB Clusters are capable of switching over the current writer node to another node in the cluster within approximately 1 second or less, in case of minor engine version upgrade or OS maintenance operations. The AWS JDBC Driver has been optimized for such fast failover when working with AWS RDS Multi-AZ DB Clusters.
With thefailover plugin, the downtime during certain DB cluster operations, such as engine minor version upgrades, can be reduced to one second or even less with finely tuned parameters. It supports both MySQL and PostgreSQL clusters.
Visitthis page for more details.
The AWS JDBC Driver also works with RDS provided databases that are not Aurora.
There are limitations with the AWS JDBC Driver and RDS Proxy. This is currently intended, by design, since the main reason is that RDS Proxy transparently re-routes requests to a single database instance. RDS Proxy decides which database instance is used based on many criteria (on a per-request basis). Due to this, functionality like Failover, Enhanced Host Monitoring, and Read/Write Splitting is not compatible since the driver relies on cluster topology and RDS Proxy handles this automatically.
However, the driver can still be used to handle authentication workflows. For more information regarding compatibility, please refer to the specific plugin documentation.
Visitthis page for more details.
For more information on how to download the AWS JDBC Driver, minimum requirements to use it,and how to integrate it within your project and with your JDBC driver of choice, please visit theGetting Started page.
You can find our driver by searching in The Central Repository with GroupId and ArtifactIdsoftware.amazon:aws-advanced-jdbc-wrapper.
<!-- Add the following dependency to your pom.xml,--><!-- replacing LATEST with the specific version as required--><dependency> <groupId>software.amazon.jdbc</groupId> <artifactId>aws-advanced-jdbc-wrapper</artifactId> <version>LATEST</version></dependency>
| Parameter | Reference | Documentation Link |
|---|---|---|
wrapperDialect | DialectManager.DIALECT | Dialects, and whether you should include it. |
wrapperPlugins | PropertyDefinition.PLUGINS | |
clusterId | RdsHostListProvider.CLUSTER_ID | AWS Advanced JDBC Driver Parameters |
clusterInstanceHostPattern | RdsHostListProvider.CLUSTER_INSTANCE_HOST_PATTERN | FailoverPlugin |
secretsManagerSecretId | AwsSecretsManagerConnectionPlugin.SECRET_ID_PROPERTY | SecretsManagerPlugin |
secretsManagerRegion | AwsSecretsManagerConnectionPlugin.REGION_PROPERTY | SecretsManagerPlugin |
wrapperDriverName | DriverMetaDataConnectionPlugin.WRAPPER_DRIVER_NAME | DriverMetaDataConnectionPlugin |
failoverMode | FailoverConnectionPlugin.FAILOVER_MODE | FailoverPlugin |
enableClusterAwareFailover | FailoverConnectionPlugin.ENABLE_CLUSTER_AWARE_FAILOVER | FailoverPlugin |
failoverClusterTopologyRefreshRateMs | FailoverConnectionPlugin.FAILOVER_CLUSTER_TOPOLOGY_REFRESH_RATE_MS | FailoverPlugin |
failoverReaderConnectTimeoutMs | FailoverConnectionPlugin.FAILOVER_READER_CONNECT_TIMEOUT_MS | FailoverPlugin |
failoverTimeoutMs | FailoverConnectionPlugin.FAILOVER_TIMEOUT_MS | FailoverPlugin |
failoverWriterReconnectIntervalMs | FailoverConnectionPlugin.FAILOVER_WRITER_RECONNECT_INTERVAL_MS | FailoverPlugin |
clusterTopologyHighRefreshRateMs | MonitoringRdsHostListProvider.CLUSTER_TOPOLOGY_HIGH_REFRESH_RATE_MS | FailoverPlugin v2 |
failoverReaderHostSelectorStrategy | software.amazon.jdbc.plugin.failover2.FailoverConnectionPlugin.FAILOVER_READER_HOST_SELECTOR_STRATEGY | FailoverPlugin v2 |
failureDetectionCount | HostMonitoringConnectionPlugin.FAILURE_DETECTION_COUNT | HostMonitoringPlugin |
failureDetectionEnabled | HostMonitoringConnectionPlugin.FAILURE_DETECTION_ENABLED | HostMonitoringPlugin |
failureDetectionInterval | HostMonitoringConnectionPlugin.FAILURE_DETECTION_INTERVAL | HostMonitoringPlugin |
failureDetectionTime | HostMonitoringConnectionPlugin.FAILURE_DETECTION_TIME | HostMonitoringPlugin |
monitorDisposalTime | HostMonitorServiceImpl.MONITOR_DISPOSAL_TIME_MS | HostMonitoringPlugin |
iamDefaultPort | IamAuthConnectionPlugin.IAM_DEFAULT_PORT | IamAuthenticationPlugin |
iamHost | IamAuthConnectionPlugin.IAM_HOST | IamAuthenticationPlugin |
iamRegion | IamAuthConnectionPlugin.IAM_REGION | IamAuthenticationPlugin |
iamExpiration | IamAuthConnectionPlugin.IAM_EXPIRATION | IamAuthenticationPlugin |
awsProfile | PropertyDefinition.AWS_PROFILE | AWS Advanced JDBC Driver Parameters |
wrapperLogUnclosedConnections | PropertyDefinition.LOG_UNCLOSED_CONNECTIONS | AWS Advanced JDBC Driver Parameters |
wrapperLoggerLevel | PropertyDefinition.LOGGER_LEVEL | Logging |
wrapperProfileName | PropertyDefinition.PROFILE_NAME | Configuration Profiles |
autoSortWrapperPluginOrder | PropertyDefinition.AUTO_SORT_PLUGIN_ORDER | Plugins |
loginTimeout | PropertyDefinition.LOGIN_TIMEOUT | AWS Advanced JDBC Driver Parameters |
connectTimeout | PropertyDefinition.CONNECT_TIMEOUT | AWS Advanced JDBC Driver Parameters |
socketTimeout | PropertyDefinition.SOCKET_TIMEOUT | AWS Advanced JDBC Driver Parameters |
tcpKeepAlive | PropertyDefinition.TCP_KEEP_ALIVE | AWS Advanced JDBC Driver Parameters |
A Secret ARN has the following format:arn:aws:secretsmanager:<Region>:<AccountId>:secret:SecretName-6RandomCharacters
Enabling logging is a very useful mechanism for troubleshooting any issue one might potentially experience while using the AWS JDBC Driver.
In order to learn how to enable and configure logging, check out theLogging section.
Technical documentation regarding the functionality of the AWS JDBC Driver will be maintained in this GitHub repository. Since the AWS JDBC Driver requires an underlying JDBC driver, please refer to the individual driver's documentation for driver-specific information.
To find all the documentation and concrete examples on how to use the AWS JDBC Driver, please refer to theAWS JDBC Driver Documentation page.
Support for Blue/Green deployments using the AWS Advanced JDBC Driver requires specific metadata tables. The following service versions provide support for Blue/Green Deployments:
- Supported RDS PostgreSQL Versions:
rds_tools v1.7 (17.1, 16.5, 15.9, 14.14, 13.17, 12.21)and above. - Supported Aurora PostgreSQL Versions: Engine Release
17.5, 16.9, 15.13, 14.18, 13.21and above. - Supported Aurora MySQL Versions: Engine Release
3.07and above.
Please note that Aurora Global Database and RDS Multi-AZ clusters with Blue/Green deployments is currently not supported. For detailed information on supported database versions, refer to theBlue/Green Deployment Plugin Documentation.
This driver currently does not supportplanned failover orswitchover of Amazon Aurora Global Databases. Failing over to a secondary cluster will result in errors and there may be additional unforeseen errors when working with global databases. Connecting to the primary cluster is fully supported. There is a limitation when connected to the secondary cluster; thefailover2 plugin will not work on the secondary cluster, however thefailover plugin will work. When working with Global Databases and accepting the driver's limited support, ensure you explicitly provide a list of plugins. This is crucial because thefailover2 plugin, which is enabled by default, does not support Global Databases as previously mentioned. By specifyingfailover plugin along with your desired plugins, you can ensure (still limited) functionality with Global Databases. Full Support for Amazon Aurora Global Databases is in the backlog, but we cannot comment on a timeline right now.
| Description | Examples |
|---|---|
| Using the AWS JDBC Driver to get a simple connection | PostgreSQL |
| Using the AWS JDBC Driver with failover handling | PostgreSQL |
Using the AWS IAM Authentication Plugin withDriverManager | PostgreSQL MySQL MariaDB |
Using the AWS IAM Authentication Plugin withDataSource | PostgreSQL and MySQL |
Using the AWS Secrets Manager Plugin withDriverManager | PostgreSQL MySQL |
| Using the AWS Credentials Manager to configure an alternative AWS credentials provider. | PostgreSQL and MySQL |
Using the AWS JDBC Driver withAWSWrapperDatasource | PostgreSQL |
| Using the Driver Metadata Plugin to override driver name, this pluginenables specific database features that may only be available to target drivers | PostgreSQL |
Using the Read/Write Splitting Plugin withDriverManager | PostgreSQL MySQL |
| Using the Read/Write Splitting Plugin with Spring | PostgreSQL MySQL |
Using HikariCP with theAWSWrapperDatasource | PostgreSQL |
Using HikariCP with theAWSWrapperDatasource with failover handling | PostgreSQL |
| Using Spring and HikariCP with the AWS JDBC Driver | PostgreSQL |
| Using Spring and HikariCP with the AWS JDBC Driver and failover handling | PostgreSQL |
| Using Spring and Hibernate with the AWS JDBC Driver | PostgreSQL |
| Using Spring and Wildfly with the AWS JDBC Driver | PostgreSQL |
| Using Vert.x and c3p0 with the AWS JDBC Driver | PostgreSQL |
| Using the AWS JDBC Driver with Telemetry and using the AWS Distro for OpenTelemetry Collector | PostgreSQL |
| Using the AWS JDBC Driver with Telemetry and using the AWS X-Ray Daemon | PostgreSQL |
If you encounter a bug with the AWS JDBC Driver, we would like to hear about it.Please search theexisting issues to see if others are also experiencing the issue before reporting the problem in a new issue. GitHub issues are intended for bug reports and feature requests.
When opening a new issue, please fill in all required fields in the issue template to help expedite the investigation process.
For all other questions, please useGitHub discussions.
- Set up your environment by following the directions in theDevelopment Guide.
- To contribute, first make a fork of this project.
- Make any changes on your fork. Make sure you are aware of the requirements for the project (e.g. do not require Java 7 if we are supporting Java 8 and higher).
- Create a pull request from your fork.
- Pull requests need to be approved and merged by maintainers into the main branch.
Note: Before making a pull request,run all tests and verify everything is passing.
The project source code is written using theGoogle checkstyle, and the style is strictly enforced in our automation pipelines. Any contribution that does not respect/satisfy the style will automatically fail at build time.
Theaws-advanced-jdbc-wrapper has a regular monthly release cadence. A new release will occur during the last week of each month. However, if there are no changes since the latest release, then a release will not occur.
Thisaws-advanced-jdbc-wrapper is being tested against the following Community and Aurora database versions in our test suite:
| Database | Versions |
|---|---|
| MySQL | 8.0.36 |
| PostgreSQL | 16.2 |
| Aurora MySQL | - Default version. To check the default version, open the RDS "Create database" page in the AWS console and check the pre-selected database version. - Latest release, as shown onthis page. |
| Aurora PostgreSQL | - Default version. To check the default version, open the RDS "Create database" page in the AWS console and check the pre-selected database version. - Latest release, as shown onthis page. |
Theaws-advanced-jdbc-wrapper is compatible with MySQL 5.7 and MySQL 8.0 as per the Community MySQL Connector/J 8.0 Driver.
This software is released under the Apache 2.0 license.
About
The Amazon Web Services JDBC Driver has been redesigned as an advanced JDBC wrapper. This wrapper is complementary to and extends the functionality of an existing JDBC driver to help an application take advantage of the features of clustered databases such as Amazon Aurora.
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.