OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Adding support for AWS RDS for om service main database

Open ArtyomyuS opened this issue 3 years ago • 6 comments

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

  1. Add maven dependency to the project for: aws-secretsmanager-jdbc or rds and sts
  2. Update database connection configuration to consider DB_PROTOCOL as url: ${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.xml file or it shall be added only in the openmetadata-service component

  • Not sure if the configuration in conf/openmetadata.yaml is 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"

ArtyomyuS avatar May 24 '23 08:05 ArtyomyuS

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

pmbrull avatar May 31 '23 05:05 pmbrull

I guess the ingestion part can be easily done using: sqlalchemy-rdsiam.

ArtyomyuS avatar May 31 '23 06:05 ArtyomyuS

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)

ArtyomyuS avatar May 31 '23 09:05 ArtyomyuS

Succeeded to have an "up and running" prototype using RDS PostgreSQL. Going to provide a pull-request soon.

ArtyomyuS avatar Jun 06 '23 10:06 ArtyomyuS

Succeeded to have an "up and running" prototype using RDS PostgreSQL. Going to provide a pull-request soon.

awesome, thanks for chipping in

pmbrull avatar Jun 06 '23 13:06 pmbrull

Opened a pull-request: https://github.com/open-metadata/OpenMetadata/pull/11913

ArtyomyuS avatar Jun 07 '23 08:06 ArtyomyuS