7

Using AWS Fargate, the process to get a custom Docker container running on AWS ECS is relatively straightforward.

I was able to successfully test my container over the public IP assigned to the network interface of the VPC that the Fargate cluster is hosted in; the container is a simple HTTP server listening on 0.0.0.0:80.

I have also recently purchased a DNS domain using AWS Route53.

Now, I want to assign the DNS to the ECS service so instead of sending the request to a random IP address (which also changes with each update of the ECS service) I want to be able to send my requests directly to the root of my domain.

How can I achieve that?

1 Answers1

12

Your website visitors are not supposed to talk directly to the Fargate container. As you realised the IPs are not predictable and can change at any time - it’d be difficult to keep the DNS up to date.

Instead use Application Load Balancer in front of Fargate and use the ALB’s address for your website.

ALB will automatically register the Fargate containers as they come and go.

Hope that helps :)

MLu
  • 26,247