Search code examples
amazon-web-servicesamazon-ecs

Is it possible to get IP from host instance on ECS in bridge mode?


I checked many sources online but couldn't find one to specifically answer this.

I already checked the metadata option from inside the container, but in bridge mode, the response to the call to the metadata URL only gives me the IP of the container, not the host EC2 instance.

Is there a way around this?


Solution

  • With the bridge mode, the container shares the same network interface as that of the instance on which it is running, therefore the IP of the container is the same as that of the EC2 instance.

    You might find this useful: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html