Load balancers and calling external web services

amazon-web-servicesload balancing

I've tried searching for an answer for this question, but I'm not sure if there is a specific term for it and so far I can't find any information.

If I had a popular app that consumed some web services, I would obviously use a load balancer to distribute the load across my services. In theory the end user is just hitting a hostname and this is resolved to the load balancer which then forwards these requests to a web service instance. If my web services then also made a call to another external/3rd party web service, would this 3rd party see the individual IP from the web server in question?

For example if the 3rd party web service said I had to provide 3 ip addresses and only these 3 could access their services how would this work bearing in mind I could have 6 instances behind my load balancer and any one of these could be required to make the request? As the request is made from an individual web server, I'm guessing it wouldn't 'go out' of the load balancer. Although this is quite a generic question, an example of how this might be set-up on AWS infrastructure would be useful

Thanks

Best Answer

You could accomplish what you need by putting your app servers in a private subnet in a VPC, which routes 0.0.0.0/0 to a NAT instance in a public subnet. All requests to the 3rd part service would appear from the NAT's external IP (assign an Elastic IP to keep it consistent).

The NAT will be a bottleneck for these requests, so you'll need to make sure it's adequately scaled. If you have 3 IPs you could whitelist, you could put your app servers and NAT devices across 3 AZ's with a separate NAT instance in each AZ.

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html