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 Answer
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
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions