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

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ