Unable to connect to new RDS instance (timeout)

0

This is my second attempt at this. I have restored a snapshot of a working DB backup to a brand new instance. I used identical settings to the original, and allowed it to create a new VPC, new security group, etc (to minimise any issues with connectivity). I set Public access to 'Yes'. However, when I now try to connect to the DB, I simply get a timeout message. I can still connect to the original instance (used to create the snapshot), and am using the same login credentials. Specifically, the error I get it as follows;

2003 - Can't connect to MySQL server on 'migrationtest.ca*********.us-east-1.rds.amazonaws.com' (60 "Operation timed out")

This was also the case with the previous snapshot. I simply want to create a snapshot that I can access externally (no major security concerns for now) from my laptop. Given that I allowed it to create new VPC and security groups, I can't understand what else could be blocking access.

As it stands the instance is active, CPU usage is down at 2%, and Publicly accessible is set to Yes. Security group is defaulted to allow all traffic (as far as I can tell). VPC seems to be configured to route IGW as expected. AWS doesn't seem to provide support for these kinds of problems, so posting here in the hopes that someone can tell me if I'm doing something wrong. Thanks.

3 Answers
1
Accepted Answer

You say that you have restored a snapshot of your original database, thus creating a new RDS instance. Can you verify that the VPC Subnet where you have created this new RDS instance is in a public subnet.

To do this, check the routing table that the subnet is using and make sure that it has a default route (0.0.0.0/0) to an internet gateway that is associated with your VPC.

Other that - if you are not using the same security group on. your RDS instance - make sure the one you are using allows TCP traffic to port 3306 from anywhere.

AWS
EXPERT
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • The simplest answer is often the correct one. Whilst the other answers were also correct, this one got me there fastest.

    Sadly, I made the mistake of expecting AWS to create the instance in a 'working' state. When deploying a new instance, If I select for it to be created as 'publicly available', I would naturally expect the default rule to at very least allow 3306 (the only traffic for this given instance). Instead, it seemingly creates a default rule that blocks ALL traffic. I had interpreted the security rule as defaulting to an allow all rule. Even now, looking at the rules, it shows a rule for ALL, then directly below it I have a seemingly identical style rule that allows only 3306... totally nonsensical and misleading UI.

    I suspect there are a lot of people that get caught out in this way. I hope that AWS will do things in a more logical (and helpful way) in future. Thank you for solving this. I only wish it wouldn't cause the next person a similar headache

1

Timeout means something with networking (e.g. security groups). You need to check it.

profile picture
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • Also if public it needs to be in a subnet with a route to and internet gateway and not a NAT gateway.

  • It was the security group, but a more elaborate answer would have been more helpful. Thank you for your advice.

1

Given that I allowed it to create new VPC and security groups, I can't understand what else could be blocking access.

New subnets would have been created within the new VPC, and these would be then be configured to comprise a subnet group, into which the new instance would be placed.

For you to reach this from your laptop these subnets will all have to be public subnets, meaning their route tables each have to have an entry for 0.0.0.0/0 that points to an Internet Gateway. This needs to be in place for all the subnets that make up the subnet group into which the recovered RDS instance is placed (a mix of public & private subnets won't work).

Taking a step back, is the recovered database's endpoint DNS name publicly resolvable, or has it been setup with a private IP only? Right away that would prevent any public access.

You may want to consider Reachability Analyser, which can be customised to work with RDS https://aws.amazon.com/blogs/database/troubleshoot-network-connectivity-to-amazon-rds-databases-using-vpc-reachability-analyzer/

profile picture
EXPERT
Steve_M
answered a month ago
  • This might have been the most detailed answer, but I tried the network analyser and found it to be a total nightmare. Too complicated to use given the massive capabilities and complexity. I needed to test from an external source (or destination!?), and there doesn't seem to be an easy way to set that. I tried setting it to the IGW, but that gave a false success, so no idea what that was about. Thanks for your advice

  • In AWS Console can you go RDS -> Subnet Groups and select the subnet group into which the RDS instance was restored.

    There should be a panel headed Subnets with clickable links to all of the subnets that comprise the subnet group. Open each subnet (it might easiest to open each of them in a new browser tab) and verify that each has an entry in its route table to an Internet Gateway.

    Or come at it from the other direction, in AWS Console -> VPC select the VPC into which the RDS instance was restored, and select the Resource map tab.

    Hover over the entry for Internet Gateway in the Network connections panel on the right and this should highlight which subnets have a route to the Internet Gateway. All of the subnets in the RDS subnet group need to be lit up here.

    And no harm in asking again, the recovered instance definitely has a publicly routable IP address, e.g it doesn't start with 10. or 172. ?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions