Flyway with AWS Aurora over SSH tunnel not working
See original GitHub issueRelated: 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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:15 (8 by maintainers)
Top Results From Across the Web
Flyway Over SSH tunnel - mysql - Stack Overflow
You should try to use the local loopback IP address which is now the virtual location of your database because of the SSH...
Read more >Access Your Database Remotely Through an SSH Tunnel
The tunneling command opens an SSH session with the [remote host] specified. The tunnel will work as long as that SSH session is...
Read more >Why can't I connect to my Amazon RDS DB or Amazon Aurora ...
If your client must connect through the public internet, then use SSH Tunneling as an intermediate host. This allows you to connect into...
Read more >Integrating Flyway with Aurora Serverless and AWS Fargate
This section will go over creating an Aurora Serverless Database. For the purpose of this tutorial we will just be using the Amazon...
Read more >ssh tunnel for RDS via bastion host | by Aravind G V
Our RDS db is hosted on Amazon. Our Bastion(Jumphost) can connect to the db. Connections to the db are not allowed outside of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.