My application which is hosted on EC2 instance which is in private subnet is not connecting with RDS which is in private subnet

1

My application is hosted in Ec2 instance(windows) and MySQL database in AWS RDS. Since both Ec2 instance(windows) and RDS MySQL both are in same vpc same region and on private subnet, my application is not connecting with RDS database.

Tried by adding security group but it doesnt help. Please provide suggestion to connect my Ec2 instance and RDS. So that my application should connect with database.

Subha
질문됨 한 달 전109회 조회
2개 답변
0

Hello.

If you encounter an error when connecting, could you please share the error message?
Also, could you please share your EC2 security group settings and RDS security group settings?

If you get a timeout error, you may need to check the settings of your security group, subnet network ACL, Windows firewall, etc.
https://repost.aws/knowledge-center/rds-cannot-connect

You also need to make sure that "enableDnsHostnames" and "enableDnsSupport" are enabled in your VPC.
https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-support
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html

If you want your DB instance in the VPC to be publicly accessible, make sure to turn on the VPC attributes DNS hostnames and DNS resolution.

profile picture
전문가
답변함 한 달 전
profile pictureAWS
전문가
검토됨 한 달 전
  • Hi Riku, Didier, Thanks for your suggestion. As like steve said assumption only had my security groups. And also, "enableDnsHostnames" and "enableDnsSupport" enabled in my VPC.

0

Ec2 instance(windows) and RDS MySQL both are in same vpc same region and on private subnet

Can you confirm that the EC2 instance and RDS instance are in the same subnet?

Tried by adding security group but it doesnt help.

Which security group settings did you try? Assuming that MySQL is running on its default port 3306, your EC2 instance will need a security group with an outbound rule allowing TCP port 3306 to the RDS instance's private IP address (or subnet, or just make it 0.0.0.0/0 for troubelshooting, you can tighten it later). On the RDS instance, it will need a security group associated with it which has an inbound rule allowing TCP port 3306 from the EC2 instance's private IP address (or subnet, or again just make it 0.0.0.0/0 to get it working).

profile picture
전문가
Steve_M
답변함 한 달 전
  • Hi Steve, Thanks for your update. Ec2 instance and RDS are in subnet. As like your assumption only i have configured security groups of RDS and EC2. My application which is hosted on IIS in windows server Ec2 instance is not connecting with Mysql RDS database.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠