Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions java/pgjdbc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Aurora DSQL is a distributed SQL database service that provides high availabilit
your PostgreSQL-compatible applications. `pgJDBC` is a popular PostgreSQL adapter for Java that allows
you to interact with PostgreSQL databases using Java code.

This example uses the Aurora DSQL JDBC Connector to handle IAM authentication automatically.

## About the code example

The example demonstrates a flexible connection approach that works for both admin and non-admin users:

* When connecting as an **admin user**, the example uses the `public` schema and generates an admin authentication
token.
* When connecting as a **non-admin user**, the example uses a custom `myschema` schema and generates a standard
authentication token.
* When connecting as an **admin user**, the example uses the `public` schema.
* When connecting as a **non-admin user**, the example uses a custom `myschema` schema.

The code automatically detects the user type and adjusts its behavior accordingly.

Expand Down Expand Up @@ -114,6 +114,7 @@ The example contains comments explaining the code and the operations being perfo
## Additional resources

* [Amazon Aurora DSQL Documentation](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/what-is-aurora-dsql.html)
* [Amazon Aurora DSQL JDBC Connector](https://github.com/awslabs/aurora-dsql-jdbc-connector)
* [pgJDBC Documentation](https://jdbc.postgresql.org/documentation/)
* [AWS SDK for Java Documentation](https://docs.aws.amazon.com/sdk-for-java/)

Expand Down
11 changes: 7 additions & 4 deletions java/pgjdbc_hikaricp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ This example demonstrates how to connect to Aurora DSQL using HikariCP connectio
- **Monitoring**: Built-in metrics and leak detection
- **Configuration**: tuning options to align with token refresh

This example uses the Aurora DSQL JDBC Connector to handle IAM authentication automatically.

## About the code example

The example maintains the flexible connection approach as maintained in the standalone `pgJDBC` and Amazon Aurora DSQL example and continues to work for both admin and non-admin users. It introduces connection pooling via the HikariCP library and supports DSQL's dynamic IAM token generation and token refresh.
The example maintains the flexible connection approach as maintained in the standalone `pgJDBC` and Amazon Aurora DSQL example and continues to work for both admin and non-admin users. It introduces connection pooling via the HikariCP library.

### Token Refresh Architecture
### IAM Authentication

Aurora DSQL uses IAM-based authentication with short-lived tokens (15 minutes by default). This example implements a custom `CustomPGDataSource` that extends PostgreSQL's `PGSimpleDataSource` to automatically generate fresh tokens for each connection request. The token generation process uses AWS SDK's `DsqlUtilities` to create admin or non-admin tokens based on the user type.
Aurora DSQL uses IAM-based authentication with short-lived tokens (15 minutes by default). The Aurora DSQL JDBC Connector handles token generation and refresh automatically, creating admin or non-admin tokens based on the user type.

## ⚠️ Important

Expand Down Expand Up @@ -138,8 +140,9 @@ These settings provide a production-ready configuration that handles Aurora DSQL

## Additional resources

- [HikariCP](https://github.com/brettwooldridge/HikariCP)
- [Amazon Aurora DSQL Documentation](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/what-is-aurora-dsql.html)
- [Amazon Aurora DSQL JDBC Connector](https://github.com/awslabs/aurora-dsql-jdbc-connector)
- [HikariCP](https://github.com/brettwooldridge/HikariCP)
- [pgJDBC Documentation](https://jdbc.postgresql.org/documentation/)
- [AWS SDK for Java Documentation](https://docs.aws.amazon.com/sdk-for-java/)

Expand Down
11 changes: 6 additions & 5 deletions java/spring_boot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ shows you how to connect to an Aurora DSQL cluster and perform basic database op
Aurora DSQL is a distributed SQL database service that provides high availability and scalability for
your PostgreSQL-compatible applications.

This example uses the Aurora DSQL JDBC Connector to handle IAM authentication automatically.

## About the code example

The example demonstrates a flexible connection approach that works for both admin and non-admin users:

* When connecting as an **admin user**, the example uses the `public` schema and generates an admin authentication
token.
* When connecting as a **non-admin user**, the example uses a custom `myschema` schema and generates a standard
authentication token.
* When connecting as an **admin user**, the example uses the `public` schema.
* When connecting as a **non-admin user**, the example uses a custom `myschema` schema.

The code automatically detects the user type and adjusts its behavior accordingly.

Expand Down Expand Up @@ -120,10 +120,11 @@ mvn spring-boot:run

## Additional resources

- [Amazon Aurora DSQL Documentation](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/what-is-aurora-dsql.html)
- [Amazon Aurora DSQL JDBC Connector](https://github.com/awslabs/aurora-dsql-jdbc-connector)
- [Spring Boot Documentation](https://spring.io/projects/spring-boot)
- [Spring Data JDBC](https://spring.io/projects/spring-data-jdbc)
- [HikariCP](https://github.com/brettwooldridge/HikariCP)
- [Amazon Aurora DSQL Documentation](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/what-is-aurora-dsql.html)
- [AWS SDK for Java Documentation](https://docs.aws.amazon.com/sdk-for-java/)

---
Expand Down
Loading