'AWS ECS Containers and External DNS

  • We have AWS ECS instances.
  • We're using an external service (Twilio) that needs to reach a specific container:port.
  • And it's SSL, so it has to be a DNS name

Currently, our Upgrade scripts assigns each container an entry in Route53, and I can use a combination of nslookup and my external IP address to discover my name (and then set an env var) on bootup.

But if containers crash, my upgrade script won't have run, so updating Route 53 won't have happened.

Is this problem already solved in some way? At this point, I'm looking at 2 or 3 days to implement a solution.

I don't believe I can use Service Discovery, as SD uses the internal IP address and would be in foo.local, which isn't externally accessible.

At this point, I think I have to write a program that determines what my DNS name needs to be and updates Route 53. That seems simple, but I also have to add permissions to update Route 53 to the IAM user inside the container, and that sounds like a security problem. I'd write a different program to expire dead names.

Is there a better way? This doesn't seem like that unique a problem.



Solution 1:[1]

Isn't this the problem that ECS Services and their integration with AWS Load Balancers solve? If you have an ECS task that needs to run for a long time, and it needs to be accessible at a public address, then it needs to run in an ECS service that is configured to use a public load balancer.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark B