Create static IP for Google Places API keys restri

2019-08-05 12:00发布

问题:

I use Google Places API, and I need to put a restriction on my API keys, more specifically an IP restriction because the calls are from a web server.

I am using AWS Elastic Beanstalk with an environment where I have a Load Balancer, Autoscaling, and a VPC. So the IP address changes every time a new EC2 server is created.

My question is : How do I put a static IP (Elastic ?) on my environment?

I have found many similar posts like this one (https://stackoverflow.com/a/49200693/3954420) or this one (https://medium.com/@obezuk/how-to-use-elastic-beanstalk-with-an-ip-whitelisted-api-69a6f8b5f844) where I have to create a NAT Gateway. But it requires at the end to type a target IP address, and unfortunately, Google API servers IPs are not static.

How can I use NAT Gateway or is there another way ?

Thanks