How can I define a destination nat in a fargate container? If I was creating containers under EC2 instances I would use iptables and create a dnat entry. Can that be done in a fargate container and if so, how?
I have not been able to figure out how to define iptables in a fargate container yet. I cannot use a Net Gateway because I am not trying to do a NAT to an internal address, but I need to define a destination NAT.
2
Answers
I don’t think it can be done. I’ve tried before and didn’t find any feature available to do that.
What I ended up doing was adding a Route53 private hosted zone to the VPC for the custom DNS resolution within the VPC.
You should use a NLB, set up a listener on a port you need, add a target groupt to the listener. Optionally, put a Global Accelerator with single static IP in fron of the NLB and you will have exactly the same networking as you want.