In order to log in to your database, the typical approach is to set your username and password in the Flyway configuration file. This however has some concerns:
Flyway comes with additional authentication mechanisms that tackle these concerns.
By storing your username and password in the environment variables
FLYWAY_PASSWORD respectively, they can be configured once and used across multiple Flyway configurations. They can also be set by someone who has the relevant access, so they do not end up being leaked to any unwarranted parties.
Configure the JDBC URL to point to an AWS RDS instance:
flyway.user to be the database user and
flyway.password to be the IAM authentication token:
You can read more about AWS IAM in Java applications here.