How do I associate an ElasticIP to an API Gateway in AWS?
It's not possible to associate an Elastic IP address with an API Gateway.
However, even if it was possible, it would not solve your issue. This is because your executing code (either Lambda or an EC2-instance behind-the-scenes) is where your logic is running. It is from there that you want to have a fixed IP address that you can whitelist.
This is possible to do using a NAT Instance or NAT Gateway with an Elastic IP address.
- Setup a VPC to run your code in.
- Create a public subnet with a NAT instance or NAT gateway. Give this an Elastic IP address.
- Create a private subnet that talks to the internet via the NAT gateway.
- Configure your Lambda function(s) or your EC2 instances to execute in the private subnet.
If you do this, then all out-bound connections from your functions will exit from the NAT with the fixed IP address. You can then whitelist that Elastic IP address.