AWS: can't connect to RDS database from my machine

It turns out it is not that hard. Do these steps:

  1. Go to EC2 Dashboard
  2. Go to Security Groups tab
  3. Select and only select the RDS database security group. You'll see the security group detail at the bottom
  4. Click Inbound tab
  5. Click Edit button
  6. Add Type:MYSQL/Aurora;Protocol:TCP;Range:3306;Source:0.0.0.0/0

Steps


MAKE SURE PUBLIC ACCESSIBILITY IS SET TO YES

This is what I spent the last 3 days trying to solve...

Instructions to change Public Accessibility


Make sure that your VPC and subnets are wide enought.

The following CIDR configuration works great for two subnets:

  • VPC 10.0.0.0/16 10.0.0.0 — 10.0.255.255 (65536 addresses)

  • Subnet 1 10.0.0.0/17 10.0.0.0 — 10.0.127.255 (32768 addresses, half)

  • Subnet 2 10.0.128.0/17 10.0.128.0 — 10.0.255.255 (32768 addresses, other half)

Adjust it if you need three subnets.


I wasn't being able to connect to my RDS database. I've manually reviewed any detail and everything was alright. There were no indications of any issues whatsoever and I couldn't find any suitable information in the documentation. My VPC was configured with narrow CIDR: 10.0.0.0/22 and each subnet had a 255 addresses. After I've changed CIDR to 10.0.0.0/16 and split it totally between two subnets my RDS connection started to working. It was a pure luck that I've managed to find a source of the problem, because it doesn't make any sense to me.