Search code examples
network-programmingamazon-ecsselenium-gridaws-fargateecs-taskdefinition

Setting up Selenium Grid on AWS Fargate


I'm trying to set up Selenium Grid on AWS fargate. I have two task definitions for the Hub and a Chrome Node. What I tried was,

  • First I deploy a hub task
  • manually add the private IP of the hub to the environment variable (SE_EVENT_BUS_HOST) of the node task definition.
  • Deploy the node task. Environment Variables

In this approach the grid starts fine with the node. But I want to pass the private IP of the hub task automatically to the node task when the node task is deploying. I do not want to use a load balancer in this case due to the cost. Given that, what would be the best approach to pass the private IP of the Hub?


Solution

  • Instead of passing the private IP addresses around like that, I suggest using ECS Service Discovery which will create internal DNS records for your services automatically. Then you can simply pass the domain name for the Hub task, for example hub.internal as your SE_ENVENT_BUS_HOST environment variable, and inside your internal network that address will resolve to the private IP of the Hub task.