Search code examples
mysqlamazon-web-servicesaws-glue

Glue cannot connect to a mysql hosted on an ec2 (public subnet)


I am trying to connect from Glue to a mysql instance hosted on an EC2.

I deployed mysql database on a public subnet (Yes this is just a POC to test it out).

I created a S3 VPC endpoint (gateway) and attached to my public subnet

For the security groups (inbound and outbound) Im using open to all (Yes this is just a POC to test out Glue connection).

my glue iam role has the glue full access policy and the administrator access policy (yes not best policy but im just trying to check why i cant connect)

I am hitting an error which states that I cant connect. But I can connect to it on a mysql client. So Im pretty sure its nothing to do with my connection string. Any help?

2021-06-11T09:34:19.680+08:00

Copy
Check that your connection definition references your JDBC database with correct URL syntax, username, and password. Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Check that your connection definition references your JDBC database with correct URL syntax, username, and password. Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

2021-06-11T09:34:19.680+08:00   Exiting with error code 30


Solution

  • Glue does not support Mysql 8 because it uses old JDBC driver. So you have to setup your own JDBC for glue:

    This feature enables you to connect to data sources with custom drivers that were not natively supported in AWS Glue such as MySQL 8 and Oracle 18.

    Alternatively, you can migrate to older MySQL.