AWS EC2 Amazon Linux – Fix Connection Issues to RDS Instance from Amazon Linux

amazon ec2amazon-amiamazon-rdsamazon-web-servicesUbuntu

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)

Best Answer

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.