Is it possible to selectively route traffic via NAT GW (to specific external IP) from public subnet in aws?

10/29/2020

I am using a 3rd party PSTN Gateway service which requires my IP be whitelisted, and my infrastructure is hosted in AWS (self managed kubernetes).

My cluster has two subnets public & private. all nodes in private subnet uses NAT GW to reach the web. while nodes in public subnet has public IP assigned so they directly reach web via internet gateway.

I want all data going to PSTN gateway to go through NAT GW while any other traffic be using internet gateway.

Since my nodes in public can scale up/down, I can not whitelist these node IP so I prefer to route the traffic through NAT gateway.

In route table of public subnet, I have added rule to route data going to PSTN GW be routed via NAT GW. but this doesn't seem to work. when I add this rule, the traffic from my public node doesn't reach PSTN GW. I do not understand why it wont work.

can anybody shed some light as to why it is not working and what is the right course to achieve what I intend to do.

Thanks in advance.

-- user743677
amazon-web-services
kubernetes
nat
networking
sip

0 Answers