Hello all,
I'm currently working with ECS Fargate containers deployed in a private subnet and facing a challenge in configuring the private DNS name or hostname for these containers. I'm looking for guidance on how to achieve this.
Here are the details of the situation:
- Infrastructure Setup: The ECS Fargate containers are deployed in a private subnet.
- Objective: I want to configure a private DNS name or hostname for these containers to facilitate communication within the private network.
If anyone has experience or insights into how this can be accomplished, I would greatly appreciate your assistance. Additionally, if there are best practices or recommended approaches for setting up private DNS names for ECS Fargate containers in a private subnet, please share them.
Your expertise and guidance will be invaluable in resolving this matter. Thank you in advance for your help!
I tried to use this solution, but I faced with another issue. I'm using Account A for network and Account B for the ECS cluster. The private hosted zone can be created only into the Account A and I'm not able to associate the hostname with my container.
Do you have any recommendation how to archive this?
I have never set it up cross-account, but from reading the document below, I think it might not be possible to set it up unless the ECS task and VPC are in the same account. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect.html
If there is another method, I think you will need to use ALB to route to tasks by DNS name. https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-update-rules.html