aws / aws-advanced-jdbc-wrapper

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.
Apache License 2.0
216 stars 45 forks source link

Document that other AWS packages for RDS and STS are also required #613

Closed LauraArmitage closed 1 year ago

LauraArmitage commented 1 year ago

Describe the issue

The getting started page states all you need is:

Then you can add the AWS advanced jdbc wrapper to your pom or gradle file, and that's it.

In actuality we also needed to add some required dependencies which aren't included in the advanced wrapper package: the RDS and STS AWS packages, so for maven the full requirement is something like:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.group</groupId>
    <version>${revision}</version>
    <artifactId>my-app</artifactId>
    <name>My App Java Service</name>
    <description>My app description</description>

    <properties>
        <postgresql.version>42.6.0</postgresql.version>
        <aws.java.sdk.version>2.20.120</aws.java.sdk.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>${aws.java.sdk.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        // other dependencies

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.jdbc</groupId>
            <artifactId>aws-advanced-jdbc-wrapper</artifactId>
            <version>2.2.3</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>rds</artifactId>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>sts</artifactId>
        </dependency>

    </dependencies>

</project>

This was really time consuming to figure out as the error messages we were receiving were not explicit about what the problem was.

In case it makes a difference to the packages required, we are also using the IAM plugin to allow passwordless authentication to our AWS RDS database.

Is there a reason the required packages aren't just included in this advanced wrapper package?

Links

https://github.com/awslabs/aws-advanced-jdbc-wrapper/blob/main/docs/GettingStarted.md

crystall-bitquill commented 1 year ago

Hi @LauraArmitage,

Thanks for reaching out and raising this issue.

To use the AWS JDBC Driver as-is will require just the listed items, but you may require additional dependencies based on what driver features you're using.

For the IAM Authentication plugin, we make a note in the documentation that the AWS Java SDK RDS v2.x is required, but we can definitely make this clearer. I've opened a PR to update the documentation. As for the STS AWS package, it is not needed by the IAM Authentication plugin. Perhaps your application requires it?

The reason these plugin specific requirements aren't included in the AWS JDBC Driver package is that the dependencies a user needs depends on their specific use case. For example, when using the IAM Authentication plugin, the AWS Java SDK RDS v2.x must be included separately in the classpath. If users do not need IAM Authentication, this dependency is also unneeded and we do not want to include unnecessary packages.

crystall-bitquill commented 1 year ago

Hi @LauraArmitage,

I wanted to let you know that changes have been merged to make the dependency requirements clearer in the documentation, as well as to check in and see if you had any other questions or concerns? If there are no updates on this ticket in the next few days, it will be closed. However, if there is anything else, please feel free to reopen this issue or to create a new one.

Thank you!