Limit API calls to AWS API Gateway

Viewed 178

I have a problem configuring my AWS API Gateway:

I have an API deployed in an EKS cluster, and it has a public load balancer, so right now, this API is accessible from everywhere. I want to allow access to this API only from AWS API Gateway, so if anyone wants to use the API, it has to be through AWS API Gateway.

The problem is that I don't know how to allow traffic to the API only from API Gateway. I tried using a security group, but AWS API Gateway IP changes all the time. I tried also using an internal load balancer in my Kubernetes deployment, but AWS API Gateway can't reach that loadbalancer!

Thanks in advance with the help!

2 Answers

You can do this by using a Network Load Balancer.

Create an internal network load balancer and have your containers be added to its target group.

Then in API Gateway create a VPCLink to your Network Load Balancer. Then use the VPCLink within your API Gateway setup.

More instructions available here.

Related