My pythonanywhere flask application is not connecting to a MySQL database on AWS

Hi. My locally run flask app connected to Amazon Window Services MySQL DB but pythonanywhere does not. I have a hacker account.

Help please? getting desperate.

here's the error message

012mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on '' (110 Connection timed out)

2018-05-10 11:37:47,679: OSError: write error 2018-05-10 11:37:47,680: Error running WSGI application 2018-05-10 11:37:47,680: GeneratorExit


I think there is confusion here. the database i have is on amazon. I want my flask to use my amazon MySQL service. I don't this reply is a fix for my problem. Cheers.

@Musky -- you're right, Glenn was confused. If you're unable to connect to your AWS database from PythonAnywhere, it's likely to be being blocked by the database's own security settings. Exactly where those are will depend on your specific configuration on AWS (for example, whether you're in EC2-classic or using a VPC) but in the most common situation, you'd need to navigate to RDS inside the AWS console, find your database instance in the "Instances" list and click on it, then look at the "Security group rules" to see which IP addresses are allowed/not allowed to access the DB.

Unfortunately we don't have a fixed set of IP addresses that websites on PythonAnywhere run on -- your site might move from server to server over time -- so in order to let it be accessed from PythonAnywhere, you'd have to open up access to all of the us-east-1 region :-(

Thanks. the URL ( is good for old Blighty (UK) but not for python anywhere as you guys sit in the east of USA. thanks, I'll give it a whirl tonight!

Great! Let us know how you get on.

Well, the problem moves to the domain of AWS and considering I had the database based in AWS europe, I was able to download it to my pc ... but not able to upload it to AWS in eastern USA due to geoblocking!!!!!!

There are probably AWS options to duplicate and copy but I am virtually a one man band, I haven't the time to figure it out... using pythonanywhere sql for now... yet MySQL Workbench won't connect so I did it via an sql session.. cut and paste! it's only a 30k database!

Getting there!