I have to make connection of aws fargaet container to access documentdb.

0

Hello everyone,

my backend nodejs app in running in fargate container and in logs give me connection error with db. I have documentdb to connect. Additionally, both fargate and documentdb is created in same vpc, also I have connection string in my app.

Enter image description here

like this Enter image description here

this is what in my ecs service task definition section. Enter image description here

Is this error related to connectivity of fargate with documentdb? Enter image description here

1回答
0
承認された回答

Hello.

It appears that there is a problem communicating from Fargate to Documentdb because a timeout error is being output.
Does DocumentDB's security group allow communication from Fargate?
The default port for DocumentDB is 27017.
I think you can check the security group used by DocumentDB by following the steps in the document below.
https://docs.aws.amazon.com/documentdb/latest/developerguide/db-cluster-view-details.html

profile picture
エキスパート
回答済み 8ヶ月前
profile pictureAWS
エキスパート
レビュー済み 8ヶ月前
  • For communicating from Fargate to Documentdb I added sg of documentdb in inbound rule of fargate sg like how we do for alb is it correct?

  • Thank you for your reply. You need to set Fargate's security group in the inbound rule of DocumentDB's security group.

  • @Riku_Kobayashi I have added sg of my fargate service in documentdb sg inbound but still getting error.

  • Have you checked the network ACL settings? Also, try launching EC2 in the subnet used by Fargate and see if you can access DocumentDB. If you can access it from the command line from EC2, it may not be a network problem. You may also need to check the code and task definitions you are using.

  • It is able to connect from ec2 via ssh tunneling and what I need to check in code and task definition?

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

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

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

関連するコンテンツ