If you still have this problem, check your security groups. I was lost in a similar problem and solved it by allowing connections from the security group in which the ec2 instance was running to the security group in which the RDS database was running.
So, if your EC2 instance is in the sg-randomomec2name security group, and your rds instance is in the sg-randomrdsname security group, edit the incoming rules for sg-randomrdsname to allow connections from sg-randomec2name.
source share