0

I have a newly created Linux Amazon Linux EC2 instance and an Ubuntu instance.

And both instances try to connect to the same RDS.

The settings of both instances are exactly the same. Security groups and VPCs are the same. Only linux images are different.

But, Amazon Linux instance can't connect to RDS instance. but ubuntu instance can.

What difference made this result?

I tried to connect with this command:

mysql -h <host> -u <user> -p

And on Amazon Linux instances, I get the following results:

ERROR 2003 (HY000): Can't connect to MySQL server on '<host>' (110)
  • 2
    Do you mean "Amazon Linux" rather than "AMI instance"? Difficult to say based on the little information you've provided, Amazon Linux connects to RDS fine when properly configured. You can't ping RDS to test connectivity, but you can telnet or similar to port 3306 to see what happens. What happens when you try that? Can the instance connect to each other? Is iptables running and blocking connections? Please edit your question to show the work you've done / do for diagnostics. – Tim Mar 6 at 1:29
  • @Tim I mean 'Amazon Linux' and I will update question in a few minutes. – blurfx Mar 6 at 1:34
  • 1
    That's a network level error. Use VPC Flow Logs to see where the packets are going. – Tim Mar 6 at 1:44
1

You probably need to double check your RDS security group(s), it might be configured to only allow specific ec2 instance(s), especially if it was created via EBS. To change the security group on an RDS you'll have to modify the instance, select the new security group, and make sure to check the "modify now" box. If you're only adding a new group it should be safe to modify it in production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.