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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南