we have a requirement to connect docker to aurora mysql in rds

0

we have 2 docker container first one has apache and php installed along with the application code in htdocs folder and another docker has tomee and jdk along with application code in webapps folder then we need to connect to aurora mysql running on aws from docker container. We have tried different ways to connect it and not worked Could you please somebody help us here .

And please let me know, if you need more information.

asked 2 years ago928 views
2 Answers
0

I am able to connect from a docker container running on EC2 instance to Aurora & Aurora Serveless MySQL running in VPC with no public access. The only things I feel can impede connection are routing and / or security groups depending on the VPC setup.

  1. Is Aurora configured with Public or private access
  2. Are docker containers and aurora instances in the same VPC?
  3. Is the correct IP / subnet allowed access in RDS security group? Do you have the correct outbound allow access?
  4. What error do you get when trying to connect to Aurora mysql?

You can try debugging by installing a mysql docker container on an EC2 instance and testing connection to aurora.

--Syd

profile picture
Syd
answered 2 years ago
  • Is Aurora configured with Public or private access : A.It has public access Are docker containers and aurora instances in the same VPC?: B .No Is the correct IP / subnet allowed access in RDS security group? Do you have the correct outbound allow access? IP is allowed in RDS security group and yes What error do you get when trying to connect to Aurora mysql?: connection is established but facing CDB Exception,

0

Hello there,

From the notes, I understand that you are unable to connect to aurora MySQL from docker container. Please correct me if I misunderstood.

Thank you for sharing your setup details.

Please note that when encountering issues connecting to your RDS instance, you can check the following:

  • The DB instance security groups allows the right ports on inbound.
  • Ensure that you are connecting to the correct endpoint
  • The route table associated with the subnet, should allow traffic routing (have an internet gateway).
  • If your DB instance is in a private subnet, be sure to use VPC peering or AWS Site-to-Site VPN to connect to your instance securely. Check document for more information on VPC peering [1] and Site-to-Site VPN [2].
  • Ensure that your NACLs have rules that allows inbound and outbound traffic to and from your DB instance.

You may refer to the following document [3].

Meanwhile if you have further questions or require any guidance, please do not hesitate to reach out back to me. It would be my pleasure to assist you.

Have a great day.

References:

[1] https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html [2] https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html [3] https://aws.amazon.com/premiumsupport/knowledge-center/rds-cannot-connect/ [4]https://docs.aws.amazon.com/vpc/latest/userguide/vpc-peering.html

Letty
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions