AWS - LOAD BALANCER to host a server in Private subet

186 Views Asked by At

I currently having some issues trying to run a chat server in a private subnet that can have traffic in a out to the internet. I do not want to use a NAT Gateway.

I thought you could use a load balancer one with a public facing IP (Elastic IP) then route traffic to my server in the private subnet. I'm trying to mimic a VPN so I can host the can server in private subnet.

Chat a chat server be hosted within a private subnet on AWS?

if anyone could help would be great.

2

There are 2 best solutions below

1
On BEST ANSWER

then route traffic to my server in the private subnet.

Not without NAT you won't. You either need a NAT gateway or a NAT instance (be it prepackaged or something you've set up yourself). Routing from public subnets to private subnets needs NAT and private subnets by definition cannot route to the internet.

0
On

If you create a load balancer for inbound access it will need to be located in a public subnet, with a route table configured to use an internet gateway for the 0.0.0.0/0 route.

By doing this you can forward traffic from a public realm to the private server, this could be HTTP traffic, SQL traffic etc.

For any outbound traffic to the internet you need to use a NAT, without this traffic cannot be routed outbound to the internet for a private instance when using IPv4.

It would not however be a replacement for a VPN. Any applications you want to remain private should not allow inbound traffic via a load balancer.