Connect to AWS RDS MySQL database instance with Flask-SQLAlchemy

Go to your AWS RDS console and choose your instance -> DB Security Groups -> Click Default

and add a new CIDR as per the recommended IP range.

This is basically a firewall configuration which determines who can connect to the database instance.

You could set it as 0.0.0.0/0 so that firewall doesn't prevent you from accessing it from any host/network.


This is a valid path: EC2 dashboard -> Find network & security from left side panel -> Security groups.

Security groups

If you have a security group created, you may go to number 2.

  1. Creating a new security group:

There you can name your security group and description.

VPC will probably be automatically created for you.

Create security group window

After creating it, select it from the list.

  1. Set up inbound and / or outbound connections:

Here you can configure inbound connections rules.

Inbound window

On edit -> add rule you have default presets for easy configuration, for example HTTP on port 80.

Edit inbound connection rules window

I hope this helps everyone from now on.

  • Due to security reasons, try to only allow trusted IPs and / or security groups needed.

make sure you're creating a database name in the initial setup of the database under addition configuration unless AWS RDS won't create a database.