skip to Main Content

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


  1. Chosen as BEST ANSWER

    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. =)


  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search