Answer: simply open the port of the security groups on both side EC2 and RDS. go to security groups>edit inbound rules>select mysql, port 3306,source anywhere-ipv4.