0

I am trying a new, simple deploy setup based on ECS and Fargate. I created a Cluster and a Task Definition. No ELB, no service.

On each deploy, I just create a new Task (Task Definition instance).

My problem is that this running Task has assigned a public IP, which is different every time the Task restarts: enter image description here

If I add an ELB on the top of this, an external DNS name is assigned instead of the public IP.

Is there a way to ensure a long-tern external DNS name in my simple setup (no ELBs), so I can rely on it?

Aleks
  • 5,674
  • 1
  • 28
  • 54

1 Answers1

1

You would not want to assign a DNS hostname to a fargate task, primarily because the IP address assigned is not static.

For other services you would normally assign a elastic ip address to the resource, but Fargate does not currently support this.

Because of this anytime you perform an action that would replace the container (such as updating the task definition) the public ip address would be added to the pool of public IP addresses Amazon owns with a new one being assigned for the next container.

I would suggest adding an ELB if you possibly can, otherwise you'll need to automate the rotation of the DNS hostname everytime a container starts.

Chris Williams
  • 32,215
  • 4
  • 30
  • 68
  • Sounds reasonable, thanks, I will probably go this way. You say "Fargate does not support this". And what about the Elastic Network Interface assigned to the task? Isn't it providing the way to get the external DNS? – Aleks Jul 02 '20 at 09:16
  • The launching of a container does not support configuration for adding an EIP when the task launches at the moment, theres an open issue open for it here: https://github.com/aws/containers-roadmap/issues/311. You could try to add an elastic IP but as its not supported officially yet you would be responsible for any issues that came out of that (such as dissassociating the EIP before the container is removed) – Chris Williams Jul 02 '20 at 09:22