0
votes

We use google maps api key with thousands of sites, how can we restrict by IP address when our sites are behind AWS EC2 Load Balancers that don't have static IPs?

1
I would say this site is more appropriate for your question: serverfault.com/help/on-topic - Bob Yoplait

1 Answers

0
votes

So requests coming in from your load balancer contain a Google Maps API key, and also need to be restricted by IP address? That doesn't make sense to me.

I think what you mean is that you want to tell Google what server IP addresses are allowed to use your API keys to make API calls to Google Maps. If that's the case then the fact that they are behind a load balancer is not relevant. Traffic comes into servers from the load balancer, but API requests going out of your EC2 servers to Google do not go through the load balancer. So you could assign Elastic IPs to each server and then whitelist those IPs with Google. Of course if you are doing auto-scaling, or if you have lots of servers Elastic IPs aren't a good solution, in which case you should use NAT gateways or HTTP Proxies for the EC2 instances, and whitelist the IP addresses of the NAT or Proxy servers.