0

I am trying to connect to on-premise MongoDB from AWS Glue.

I have created a Database connection with connection type as MongoDB, SSL enabled true, VPC, Subnet, Security group in AWS console. I added a ETL Python script to connect the MongoDB.

while executing the script, the job throws below SSL error

py4j.protocol.Py4JJavaError: An error occurred while calling o114.getDynamicFrame.
: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=*********, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}}]
    at com.mongodb.internal.connection.BaseCluster.getDescription(BaseCluster.java:177)

Any suggestion to fix this issue? Since, there is no option to provide ssl cert while creating the MongoDB data connection in AWS Glue Console.

Adelino Silva
  • 577
  • 3
  • 16
Raja
  • 11
  • Seems like MongoDB is not in the SSL-supported list. But you can try to follow the steps in the doc by referencing the certificate in S3. https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html#connection-properties-SSL – lsc May 18 '23 at 16:21

2 Answers2

0

MongoDB has a native ODBC driver called as MongoDB Connector for BI. An approach to try might be to install that on a host running MongoDB, then connect to that host from Glue as if it were a MySQL database. The BI Connector supports SSL/TLS to the database from the connector.

Piyush Mattoo
  • 15,454
  • 6
  • 47
  • 56
0

If you are encountering SSL errors while trying to connect to an on-premise MongoDB from AWS Glue, you can use an ODBC driver for MongoDB from Devart that supports SSL. This will allow you to configure the necessary SSL settings and establish a successful connection to your MongoDB database within your AWS Glue ETL Python script.