Assigning a domain name to an AWS Fargate task

amazon-ecsamazon-web-services

I have an AWS Fargate task running a web app in a public subnet so it has a public address. My question is how to I connect a domain (through Route 53) to that task, so that nothing breaks when I deploy a new version of it.

  • I know I can use ALB/NLB but I want to save on costs.
  • I don't want to use the public IP directly as it may change.
  • I assume the solution has to do something with the ENI but I'm not sure how to point to it through Route 53.

Any help would be much appreciated.

Thanks

Best Answer

For most cases, you most likely want to use an ALB/NLB for service discovery. While there are some costs, you also get a lot of benefits: Some DoS protection, scaling metrics, logging, SSL/TLS

However, you can use ECS service discovery.

Service discovery uses Amazon Route 53 auto naming API actions to manage DNS entries for your service's tasks, making them discoverable within your VPC

and

Public namespaces are supported but you must have an existing public hosted zone registered with Route 53 before creating your service discovery service.

Service discovery requires that tasks use either the awsvpc, bridge, or host network mode.

Here is a Blog entry detailing how to use Service discovery with fargate: https://aws.amazon.com/blogs/aws/amazon-ecs-service-discovery/

Related Topic