How do I associate an Elastic IP with a Fargate container?

梦想的初衷 提交于 2019-12-03 17:52:30

问题


I'm exploring using the new Fargate option for my ECS containers. One constraint is that the running task must always be accessible at the same Public IP address.

My first thought was to allocate an Elastic IP but I can't tell what to associate it to. It seems an Elastic IP can be associated to an instance (which is irrelevant for Fargate) or a Network Interface. However, if I associate it with an ENI, I can't see how to ensure my task's container has that Network Interface. When creating a Service, I see that I can put it in a VPC, but that's it.

From experimentation, if I kill a task so that the service restarts a new one, or if I update the service to run a new task revision - the container that starts running the new task will have a new ENI each time.

Is there some way to ensure that a given service has the same public IP address, even if its tasks are killed and restarted?


回答1:


Fargate does not currently support ENI assignment, so it is not possible to have an Elastic IP associated with a Fargate task definition.

The only way you can use a static IP address with Fargate is via the Application Load Balancer with an alias.




回答2:


Actually your can do it with Network Load balancer. It is a special type of load balancer, where elastic IP can be added. This instruction can really help https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html



来源:https://stackoverflow.com/questions/47894034/how-do-i-associate-an-elastic-ip-with-a-fargate-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!