API Gateway, any way to get a static IP?

Apparently API Gateway doesn’t have static IPs which I need for whitelisting purposes (with another API service).

Is there any other AWS service that may help with this?

If not, I suppose I have to find another solution, perhaps my own server?

Sadly, you can’t directly.
I would love to see Global Accelerator being able to use APIGW, but currently it can’t.

You can however use the Network Load Balancer (NLB) in front, with the IP addresses of API GW as backend. The drawback, is that you need to update this IPs regularly.

There is an [AWS blog post about NLB+ALB that demonstrates how to do this using a Lambda function.

You might be able to avoid the Lambda function by using a private APIGW, which IP’s perhaps don’t change. Sorry, I never did this, so I can’t be sure. I did this setup with NLB+Private ALB only, in which case ALB’s private addresses don’t change.

Can you share some more context…
What problem are you trying to solve?
Why do you need to whitelist outbound to specific IP addresses?

You shouldn’t whitelist the IP, you should whitelist the resource ID

IPs are not a strong security control in this day and age. Are you trying to secure traffic to your API or from it? For the former you can consider API keys, for the latter client certificates.

Also facing the same challenge as OP. In my case - customer’s internal security policy.

The API is secured(with Cognito), but they still require whitelisting the traffic coming from their data center. Duh.

Does the API Gateway have to be public facing? If not, I seem for recall that API Gateway not supports private endpoints in the VPC. Could that be a suitable alternative?

Their data center is on premise. There is an application(and a huge corporate firewall) living there, which has to call API Gateway.

They have been whitelisting every single outbound IP address on their firewall for years and I doubt I can persuade them to whitelist the entire API Gateway IP addresses range.

Private Endpoints (https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-apis.html) would give you static private IPs. Could you couple it with a Transit Gateway or Direct Connect?

(Assuming that the target is under your control)

Have you given thought to using an ALB attaching an elastic IP address?

That’s… not a thing (as far as I know - would love to be corrected).

A lot of fw nowadays support domain whitelisting… do they not support that?

There is no direct way to achieve this.

You need a NLB on top of it, where you can attach static IP addresses.

https://aws.amazon.com/blogs/networking-and-content-delivery/using-static-ip-addresses-for-application-load-balancers/

You are correct. He could use an NLB and attach EIPs

He could use this setup

Client → NLB(public static IP) → VPA endpoints for API Gateway → Private API

Although NLB only process TCP requests so maybe it might not work in his case

I’ll look into it, thanks!

the other service requires it but I learned it can be overridden so have turned it off using 0.0.0.0

Voip.ms requires an IP to be whitelisted to use their api. My backend uses APIGW and lambda functions. I learned that 0.0.0.0 will whitelist all IPs and have done so.

This could work… if only I had Rest API available. Our project utilizes HTTP API which seems to be stripped of this functionality.

Thank you, I will mention this potential solution as well.

Or use Global Accelerator (which gives you 2 static IPs) and attach that to the ALB which will be a simpler config as the ‘back-end IPs’ for NLB will be changing underneath it.