Allow a remote IP to connect to your Amazon RDS MySQL Instance

SimpleBackups founder

Laurent Lemaire

Co-founder, SimpleBackups

Last update on November 15, 2023
Originally posted on November 8, 2018

Allowing certain IP addresses to access to RDS

By default, if you create an Amazon RDS MySQL database you won’t be able to connect to it unless you specifically whitelist inbound traffic sources.

In this post, I will show you step by step in the easiest way possible how to allow an IP to connect to your RDS instance (in other words, open port 3306). I am assuming this will be helpful for developers using RDS for the first time and wondering why they can’tjustconnect! 🤯

The instructions will pretty much work to open firewall ports for your AWS EC2 instances.

Note: when creating your RDS instance, make sure you choose to make it publicly accessible (it’s an option that pops up to you when creating the database).

amazon rds

How to allow certain IP addresses to access to RDS

Step 1

Choose your RDS database from the list of instances.

rds database step 1

Step 2

Scroll to the “Details” section then find the “Security groups” and click on the active security group link. This will directly redirect you to the security group you need to whitelist the IP address at.

rds database step 2

Step 3

Make sure the security group that belongs to your RDS database is selected/highlighted. If you are not sure which one it is, you can match them by the VPC ID (in this case it’s the one ending in0bc0) or the GROUP IP (ending in6cbf).

Step 4

Click on “Inbound” at the bottom (you can also right-click the highlighted item and click “Edit inbound rules”). Then click “Edit”.

rds database step 4

Step 5

In this last step you will just need to select the port to whitelist. If you are using the default MySQL port then selecting the “MYSQL/Aurora” option works. If you are using a custom port for your database, then under the “Type” dropdown select “Custom TCP Rule” and type the port number in the “Port Range” field.

Step 6

Under the “Source” we finally add the IP address or IP range we need to whitelist. Note: The IP addresses you enter here must be not he range format, which means that you need to append/32to the end of your IP address.

Example: to whitelist8.8.8.8you need to enter8.8.8.8/32in the source field.

Don’t forget to click “Save” then you are done ✅

rds database step 6

Verify You Can Connect

Personally, I like usingtelnetto check for open ports. In our case we can do the following to check if we can connect to the database instance after whitelisting the IP:

telnet hostname_or_endpoint_or_database_ip port

A successful connection to port 3306

In the screenshot above, seeing the “Connected….” means that we can successfully connect to the RDS instance. If you only see the “Trying ….” line then you are still unable to access the instance.

Still not able to connce to to your MySQL RDS?

  • Repeat the steps and make sure you followed all instructions
  • Make sure that your RDS instance is set to “Publicly Accessible”
  • Verify you are trying to connect from the same IP address you whitelisted


Back to blog

Stop worrying about your backups.
Focus on building amazing things!

Free 7-day trial. No credit card required.

Have a question? Need help getting started?
Get in touch via chat or at [email protected]

Customer support with experts
Security & compliance
Service that you'll love using