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

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则