I'm struggling to find a solution that make ALB forward traffic to API Gateway (Ideally private). Below is the flow:
Domain => ALB => API Gateway.
How can we make ALB forward traffic to private API Gateway?
CodePudding user response:
I do not think you can do this reliably. The only way I can think of is to use IP address type in your ALB's target group. This would have to be private IP address of your private API gateway interface endpoint in the VPC.
The problem is that private IP is probably not guaranteed to be static. Thus you should always use DNS name of the gateway, but ALB will not accept the DNS name. It can only take IP address.
So you can try and use the private IP address as target, and if IP changes too much you have to develop custom solution to monitor the IPs and update your ALB target groups.