How do I get my Python Flask app on an Ubuntu ec2 to connect with a MySQL db with RDS?

0

I am attempting to get my app to connect to my database on an RDS, also I am using NGINX. When connecting to the ec2 remotely using a terminal I can connect to the database there fine. It is on the public-facing side where the error exists. I followed a guide given to me by a coding school step by step. The initial login/registration page will load, but if I try to create an account or login error I get a 500 Internal service error. 500 Error

I set up my security group correctly as far as inbound rules go. Are there any outbound rules I need on the ec2 for it to be able to contact the RDS from the public ip?

Thank you

Note: I am not getting graded on this at this point, I already finished the Python stack, this is just something I still want to figure out. I don't like leaving something unfinished. I've taken the time and read many articles, watched videos, gone through AWS documentation and still cannot figure the issue out.

amazon-ec2 amazon-rds flask nginx
2021-11-24 06:13:06
1

0

In this particular instance, the issue turned out to be that the database was not located on RDS, it was on the ec2 along with the flask app. I just needed to go into the mysqlconnection.py file and change the host to 'localhost', username to 'root', and the password.

Thanks

2021-11-28 19:50:07

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................