Task to task communication with ECS

0

I have a task definition which spins up 2 webservers with stateful (sticky) websockets. In front of it a load balancer is present. How would I communicate from 1 webserver to another (task-to-task communication)?

I read about Service Connect/Discovery. AFAIK this is for Service-to-service communication. Currently I am reading out the private IPv4 address and communicate over that IP address, that works. Does that IP address change in a running task?

1 回答
0

Service Discovery is the correct route, it will allow you to manage the DNS and namespaces for your ECS Tasks. IP to IP will become a problem to keep track of as these will change if a Task, which can be done through application by querying for task's ip but that add more lift to application side.

Note: Service discovery supports the A and SRV DNS record types. DNS records are automatically added or removed as tasks start or stop in the Amazon ECS service. Tasks or applications that need to connect to your Amazon ECS service can locate an existing task from the DNS record. https://aws.amazon.com/blogs/aws/amazon-ecs-service-discovery/

AWS
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则