Search code examples
amazon-web-servicesaws-glueaws-security-group

aws rds/mysql security group for aws-glue python shell jobs


I have a Python shell job in aws-glue that talks to a rds/mysql server. I receive an error when running the job saying below. I guess it is the mysql server's security group settings. How can I update the SG to allow the connection from the aws-glue job?

mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on xxxxx.rds.amazonws.com:3306

I use python mysql-mysql-connector in my code to talk to the mysql server

    conn = connector.connect(user='dustin', password='sun',
                              host='xxxx.us-east-1.rds.amazonaws.com',
                              database='mydb')
    cursor = conn.cursor(dictionary=True)
    cursor.execute(sql)

Solution

  • It looks like you need to modify the security groups so that connections are accepted from Glue job.As you didn't mention your security groups in your question it is hard to tell what might be the issue. So refer to this link and make sure that you are configuring them properly.