Connect to the database in an EC2 instance from the ECS cluster

0

I have Superset deployed on AWS using the guide https://aws.amazon.com/quickstart/architecture/apache-superset/ where I chose to deploy it in an existing VPC. The Superset deployment worked out alright and I can access Superset at the provided link. When I try to connect to a database which is hosted in an EC2 instance, within the same VPC, I get the error, port 5432 is closed message on my Superset. The DB is up and running in the EC2 instance, which has been verified locally and remotely through my laptop.

I was previously able to connect to a database on RDS by adding the security group of the ECS Superset to the security group of the RDS instance. The same technique did not work for the ECS (Superset) -> EC2 (DB) connection. I also tried adding the IPv4 subnet range like 172...0/20 to the EC2 security group without success. These subnet ranges were obtained from the ECS deployment.

Any help to debug this issue would be greatly appreciated.

2개 답변
0
수락된 답변

What worked for me finally was using the AWS endpoint public Ipv2 DNS - ip-172...us-west-2.compute.amazonaws.com address of the EC2 instance instead of the public IP which I was trying to use before.

답변함 2년 전
0
  1. Check if MySQL DB is allowing all host IPs for given username.
  2. Use VPC Reachability Analyzer to check communication between network interfaces.
  3. Check ECS Service definition -> Security Groups -> EC2 DB Security group should be one of the value in this array.
profile pictureAWS
답변함 2년 전

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

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

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

관련 콘텐츠