AWS – Is a NAT Gateway Used with Public Application Load Balancer Traffic?

amazon-elbamazon-web-services

I'm working on the following AWS setup :

[public application load balancer] -> [fargate service on private subnet w/NAT gateway]

  • The application load balancer is associated with all three private subnets.

My understanding is that the NAT gateway will be used if a Fargate service on a private subnet initiates a request for an external resource (on the Internet).

However, in this case, the application load balancer lives in a public subnet (which has an Internet Gateway), so my understand is that traffic will move over the Internet Gateway.

Will traffic which comes in over the application load balancer move traffic over the NAT gateway?

Best Answer

Incoming traffic comes through the internet gateway, into the load balancer, then onto the containers. Return traffic goes out the same way it came in.

If your containers initiate a connection to the outside world, say to call a web service, send an email, etc, traffic goes out via the NAT gateway then the internet gateway and returns the same way.

If you are using AWS professionally you might find some AWS training useful.

Related Topic