Container on EC2 behind ALB, does it use the public IP of the ALB?

0

Hi all,

I have a development environment I'm using to test an application that needs to send information to a third party over the internet. If the container is sitting behind my application load balancer, when it attempts to connect to the external partner, does it do so using the public IP of the ALB? I need to provide the third party with the IP address where the traffic is originating. I can ping the DNS name of the ALB and see an AWS Public IP but I'm not certain this is correct. The container is running on EC2.

At a high level, the environment looks like this:

DEV Environment DEV ALB -> Target Group -> ECS-Optimized EC2 Instance -> Container

2 個答案
3
已接受的答案

Use the EC2 IP address for outbound traffic from containers on EC2 to external partners.
ALB is not used as a gateway for outbound communication from the VPC to external partners.

Also, if your EC2 is on a private subnet, communication to external partners will require a NAT gateway or similar.
In that case, the IP address becomes the IP address of the NAT gateway.

profile picture
專家
已回答 1 年前
profile picture
專家
已審閱 1 年前
profile pictureAWS
專家
已審閱 1 年前
0

Thank you for the detailed answer @Riku_Kobayashi! The EC2 instance is in fact in a private subnet so the use of a (pre-existing, in my case) NAT Gateway was the missing piece. This makes more sense now.

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南