Adding support for AWS RDS for om service main database
Is your feature request related to a problem? The current implementation of the open metadata service requires username and password in order to connection to the db. The purpose of this feature is to be able to support AWS Secret Manager integration to retrieve credentials so that to be able to connect securely to mysql db. Or to consider AWS IAM based role authentication.
Describe the solution you'd like
- Add maven dependency to the project for:
aws-secretsmanager-jdbcorrdsandsts - Update database connection configuration to consider
DB_PROTOCOLasurl: ${DB_PROTOCOL:-jdbc}:${DB_SCHEME:-mysql}://${DB_HOST:-localhost}:${DB_PORT:-3306}/${OM_DATABASE:-openmetadata_db}?allowPublicKeyRetrieval=true&useSSL=${DB_USE_SSL:-false}&serverTimezone=UTC
Describe alternatives you've considered No alternatives for this specific use case as this feature is recommended by the AWS community in order to avoid any credentials exposure through ENV variables.
Additional context
-
Not sure about the dependency if it has to be in the core
pom.xmlfile or it shall be added only in theopenmetadata-servicecomponent -
Not sure if the configuration in
conf/openmetadata.yamlis the only place to be updated with AWS dirver or there are also other places that shall be updated. -
Not sure if the airflow mysql db consider same database or there is a separate config that shall be update.
-
Not sure about the migration part that contains two dialects based on a specific driver: bootstrap/sql/com.mysql.cj.jdbc.Driver and bootstrap/sql/rorg.postgresql.Driver
-
Expected dependencies to be added:
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>rds</artifactId>
<version>2.20.32</version>
</dependency>
<dependency>
<groupId>software.aws.rds</groupId>
<artifactId>aws-mysql-jdbc</artifactId>
<version>1.1.5</version>
</dependency>
Expected DB Connection (same as today):
database:
driverClass: "software.aws.rds.jdbc.mysql.Driver"
user: <aws-iam-role>
url: "jdbc:mysql:aws://<host>:<port>/<db name>?useAwsIam=true"
to not lose context:
We use JDBI for the connection to the backend db from the server side. Harsha did some research and found https://github.com/magJ/iam-jdbc-driver, which looks like could be useful. Example. As this is also used on the ingestion (Airflow) side, this is the script we have to handle the connection https://github.com/open-metadata/OpenMetadata/blob/main/ingestion/ingestion_dependency.sh#L21. It might require some analysis to make things compatible. You can find all the necessary information to build the code locally and start working toward the contritbution here. Thanks
I guess the ingestion part can be easily done using: sqlalchemy-rdsiam.
First results with Flyway using jdbc properties throws an exception. Going to check other options:
Exception in thread "main" org.flywaydb.core.internal.license.FlywayTeamsUpgradeRequiredException: Flyway Teams Edition upgrade required: jdbcProperties is not supported by Flyway Community Edition
Try Flyway Teams Edition for free: https://rd.gt/2VzHpkY
at org.flywaydb.core.api.configuration.ClassicConfiguration.setJdbcProperties(ClassicConfiguration.java:1345)
at org.flywaydb.core.api.configuration.FluentConfiguration.jdbcProperties(FluentConfiguration.java:834)
at org.openmetadata.service.util.TablesInitializer.get(TablesInitializer.java:220)
at org.openmetadata.service.util.TablesInitializer.main(TablesInitializer.java:179)
Succeeded to have an "up and running" prototype using RDS PostgreSQL. Going to provide a pull-request soon.
Succeeded to have an "up and running" prototype using RDS PostgreSQL. Going to provide a pull-request soon.
awesome, thanks for chipping in
Opened a pull-request: https://github.com/open-metadata/OpenMetadata/pull/11913