A problem that organizations often encounter is where to store and how to access sensitive data such as the credentials for connecting to a database or their Flyway license key.
Flyway comes with support for the following secrets management solutions that enable you to successfully handle sensitive data:
AWS Secrets Manager offers a solution to the problem of handling database credentials. Secrets such as usernames and passwords can be stored in the Secrets Manager, and then accessed via an id known to authorized users. This keeps sensitive credentials out of application configuration.
Ships with Flyway Command-line | No |
---|---|
Maven Central coordinates | com.amazonaws.secretsmanager:aws-secretsmanager-jdbc:1.0.5 |
Supported versions | 1.0.5 and later |
Secrets Manager support is currently provided by the AWS Secrets Manager JDBC Library for the following databases:
To make Flyway pull credentials from the Secrets Manager, you need to perform the following steps:
flyway.driver
then remove this configuration property.jdbc:
with jdbc-secretsmanager:
.
jdbc:mariadb://localhost:1234/example_db
-> jdbc-secretsmanager:mariadb://localhost:1234/example_db
flyway.user
configuration property to contain the secret id.flyway.password
configuration property.Now you can run migrate
, info
, etc. and the credentials will be pulled out of the Secrets Manager.
Flyway integrates with Dapr’s Secret Store in order to allow users to store Flyway configuration parameters securely. This can be used to securely read license keys without storing them in application configuration, and other configuration parameters can also be stored and read such as your database password or Flyway placeholders.
Parameters stored in secrets in Dapr are read with the highest priority and will override all other configurations.
Assume we have the following two secrets in Dapr:
secret1
which contains flyway.url=jdbc:h2:mem:db
secret2
which contains flyway.user=sa
In order to read these secrets you need to configure just the following Flyway parameters:
http://localhost:3500/v1.0/secrets/my-secrets-store
flyway.plugins.dapr.secrets=secret1,secret2
After configuring the above parameters, we would be able to connect to a database in Flyway without configuring a database connection locally, as all the necessary configuration would be read from Dapr.
Flyway integrates with Google Cloud Secret Manager (GCSM) in order to allow users to store Flyway configuration parameters securely. This can be used to securely read license keys without storing them in application configuration, and other configuration parameters can also be stored and read such as your database password or Flyway placeholders.
Parameters stored in secrets in GCSM are read with the highest priority and will override all other configurations.
Assume we have the following two secrets in GCSM:
secret1
which contains flyway.url=jdbc:h2:mem:db
secret2
which contains flyway.user=sa
In order to read these secrets you need to configure just the following Flyway parameters:
quixotic-ferret-345678
flyway.plugins.gcsm.secrets=secret1,secret2
After configuring the above parameters, we would be able to connect to a database in Flyway without configuring a database connection locally, as all the necessary configuration would be read from GCSM.
Flyway integrates with Vault’s key-value engine in order to allow users to store Flyway configuration parameters securely. This can be used to securely read license keys without storing them in application configuration, and other configuration parameters can also be stored and read such as your database password or Flyway placeholders.
Parameters stored in secrets in Vault are read with the highest priority and will override all other configurations.
Assume we have the following two secrets in Vault:
test/1/config
which contains flyway.url=jdbc:h2:mem:db
and uses key-value engine V1test/2/config
which contains flyway.user=sa
and uses key-value engine V2In order to read these secrets you need to configure just the following Flyway parameters:
http://localhost:8200/v1/
s.abcdefghijklmnopqrstuvwx
flyway.plugins.vault.secrets=kv/test/1/config,kv/data/test/2/config
After configuring the above parameters, we would be able to connect to a database in Flyway without configuring a database connection locally, as all the necessary configuration would be read from Vault.