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

Viewed 38

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?

2 Answers

Using the info from Paolo's answer, I tried using "host" as a Network mode for a new Task that I needed to connect to an existing Task on another Service. I needed to this with as little change as possible to the original Task/Service.

Since I know they will all run on the same EC2 instance, by using "host" as a Network mode I was able to use "localhost" from inside the container to connect to any container running on EC2, even in a different Service/Task.

I'm happy. =)

Related