flyway: Flyway with AWS Aurora over SSH tunnel not working

Related: https://github.com/flyway/flyway/issues/1667. Breaking out as separate issue per @axelfontaine.

Software versions

OS X 10.12.6, Flyway 5.0.7 (CLI client), AWS Aurora MySQL 5.6.10a.

What did you do?

Tried to connect Flyway to an Aurora database via an SSH tunnel.

Successful direct connection:

$ ./flyway -url=jdbc:mysql://<cluster-endpoint>.<region>.rds.amazonaws.com/<db> info
Flyway Community Edition 5.0.7 by Boxfuse

Database user: <user>
Database password:
Database: jdbc:mysql://<cluster-endpoint>.<region>.rds.amazonaws.com/<db> (MySQL 5.6)
Schema version: << Empty Schema >>

+----------+---------+-------------+------+--------------+-------+
| Category | Version | Description | Type | Installed On | State |
+----------+---------+-------------+------+--------------+-------+
| No migrations found                                            |
+----------+---------+-------------+------+--------------+-------+

Setting up port forwarding:

$ ssh -L 3306:<cluster-endpoint>.<region>.rds.amazonaws.com:3306 -N bastion

Using the tunnel, incorrect user/pass is immediately rejected:

$ ./flyway -url=jdbc:mysql://localhost/<db> info
Flyway Community Edition 5.0.7 by Boxfuse

Database user: bad-user
Database password:
ERROR:
Unable to obtain connection from database (jdbc:mysql://localhost:3306/<db>) for user 'bad-user': Access denied for user 'bad-user'@'<ip>' (using password: YES)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State  : 28000
Error Code : 1045
Message    : Access denied for user 'bad-user'@'<ip>' (using password: YES)

Same tunnel, good user/pass hangs forever:

$ ./flyway -url=jdbc:mysql://localhost/<db> info
Flyway Community Edition 5.0.7 by Boxfuse

Database user: user
Database password:
<hangs>

Same result with the MariaDB driver, same result using 127.0.0.1 instead of localhost. Connections via localhost work fine via other tools (Sequel Pro, mysql CLI). No extra information with debug (-X) enabled.

What did you expect to see?

Same output as a direct connection.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@ykoasanto Thanks for confirming my initial suspicion. Closing.

Under the hood, Flyway uses the MySQL JDBC driver to connect to Aurora and delegates all network communication to it. I highly suspect the issue lies with the MySQL JDBC driver or Aurora itself. Your best bet is probably to get AWS support to investigate. Not a Flyway issue.