APP in AWS ECS Fargate Can't Connect to Remote Database in Liquid Web.

0

Hi,

I have deployed a Nest.js application on AWS ECS Fargate, and am using a Network Load Balancer with two associated Elastic IPs, one for each subnet. Now, I am attempting to connect to our remote database on Liquid Web. I have already added both IPs to the WHM firewall whitelist settings, and have also added them to the Control Panel under Remote MySQL Hosts. I have checked the security group outbound rules and the network ACLs outbound rules, and everything seems to be in order. Could you please advise on what else I need to check?

Additionally, I have attempted to connect to this remote database via localhost using the same database URL string. After allowing my local public IP in the firewall and Remote MySQL Host, I was able to connect to the database.

Also I can connect to my app using the elastic IP address associated to the network load balancer after deployment.

I hope you can help me. :)

Thank you!

Reyver
質問済み 7ヶ月前298ビュー
1回答
2
承認された回答

Hello.

Do you mean connecting to the database from a container started on Fargate?
In that case, you need to allow the Fargate container IP address in the database.
NLB is only used to access the container, so the IP address used to access the database will be the Fargate IP address.
Additionally, the IP address of Fargate containers changes when tasks are swapped, etc., so you can use a fixed IP by starting the container in a private subnet and communicating via NAT Gateway.
https://repost.aws/knowledge-center/ecs-fargate-static-elastic-ip-address

To create a static IP address for a Fargate task for outbound traffic, create a NAT gateway. In this scenario, a static IP address is required by the downstream consumer. You must place your Fargate task on a private subnet. You can use the NAT gateway IP address for an IP allow list.

profile picture
エキスパート
回答済み 7ヶ月前
profile picture
エキスパート
レビュー済み 1ヶ月前
profile pictureAWS
エキスパート
レビュー済み 7ヶ月前
  • Thanks for this. I finally solve the problem. :D

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

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

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

関連するコンテンツ