Google hosts API - "REQUEST_DENIED" when using server proxy on EC2

I'm stuck trying to get an API call in Google Places. I use a server-side PHP proxy for the request - not because I want, but because it is part of JQuery-POI-Mapper .

The server I use is an Amazon EC2 server without a static IP address. I donโ€™t have static IPs at the moment, but I will take the time to request more if people think the problem is. I determined the current public IP address of my EC2 server by running this command on the server:

curl http://169.254.169.254/latest/meta-data/public-ipv4 


Next, I went to https://code.google.com/apis/console and created a new API key. I selected the API server key and used the shared IP address of the EC2 server.


enter image description here
On the services tab, I included every associated API I could think of, including:
  • Google Maps API v2
  • Google Maps API v3
  • Google Maps gelolocation API
  • API Places
  • Static Maps API

This is where my services capture the screen:

enter image description here

The proxy code running on the EC2 server is part of the commercial package, so I do not have to publish all the code, but it is very short, and the important part:

 $json = file_get_contents($url); 

In my case, the $ url variable was:

 https://maps.googleapis.com/maps/api/place/search/json?location=-37.7133771,145.14891620000003&radius=2000&types=bakery&sensor=false&key=AIzaSyCCUV... 

I get the answer:

 { "html_attributions" : [], "results" : [], "status" : "REQUEST_DENIED" } 

I checked if I did not understand my quota, but everything looks fine. Interestingly, Google shows that I turned to the Places APIs today, so Google definitely knows that requests are coming from me.

Here is a screen capture of my API traffic report, which is all being tested:

enter image description here

Any advice would be highly appreciated.

Thanks Bret

+4
source share
1 answer

To successfully use IP blocking with an API server key, you need a static IP address.

+1
source

All Articles