Skip to content
AWS docs0.4

AWS-backed Configuration to Exposed JDBC

Latest stable Based on AWS release 0.4.0

bluetape4k-aws-exposed connects AWS-sourced database settings to a Hikari data source and an Exposed JDBC Database. The path has four separate responsibilities: locate configuration, resolve credentials, create and own the pool, and execute transactions. Keeping them separate prevents secret retrieval or IAM token refresh from leaking into repository code.

AWS configuration to Exposed database integration flow

  1. AwsDatabaseProperties describes the default database and optional named databases.
  2. AwsDatabaseConfigSource identifies Secrets Manager or Parameter Store without fetching it directly.
  3. An AwsDatabaseSettingsResolver implemented by the framework layer resolves remote values and optional RDS IAM credentials.
  4. AwsExposedDatabaseFactory validates the resolved JDBC settings, creates a Hikari data source, and calls Database.connect(dataSource).
  5. AwsExposedDatabaseRegistry exposes the default and named handles and closes their data sources in reverse order.

The factory does not start transactions. Repository or service code remains responsible for an explicit Exposed transaction boundary.

SourceUse whenOperational concern
Static/application propertiesLocal development or externally injected secretsKeep secrets out of committed configuration
Secrets ManagerA structured secret stores JDBC URL, username, password, or related fieldsDefine refresh and cache behavior; do not fetch on every query
Parameter StoreParameters are organized by path and environmentDefine prefix mapping, optional values, and refresh behavior
RDS IAM authenticationThe driver connects to an IAM-enabled RDS endpointTokens expire; generate near connection creation and preserve TLS requirements

AwsDatabaseConfigSource is intentionally storage-neutral. The foundation module does not own AWS clients. Spring Boot and Ktor adapters resolve values with their own clients and lifecycle.

Create one default handle for the common path and named handles only when the application truly has multiple pools. A registry lookup fails for an unknown name instead of silently falling back to the default. If registry creation fails halfway through, the factory closes already-created handles before rethrowing the original error.

Close the registry once at application shutdown. Spring Boot wires it as a closeable bean; the Ktor plugin closes its runtime-owned registry. If the application builds the factory directly, the application owns the registry.

Both examples use PostgreSQL Testcontainers. That proves the Hikari/driver/Exposed path against PostgreSQL, but it does not prove Secrets Manager, Parameter Store, RDS IAM, production TLS, or production pool sizing unless those paths are tested separately.

This module builds on the JDBC path in bluetape4k-exposed. Use the Exposed manual for repository patterns, transaction boundaries, database adapters, and JDBC-versus-R2DBC decisions. The AWS module is a configuration and lifecycle bridge; it does not replace the Exposed data-access model.