AWS Certified Solutions Architect - Professional 2020

Sign Up Free or Log In to participate!

Squid Proxy in private subnet with NAT gateway in public?

We have a requirement to setup a proxy in private subnet that will whitelist the websites and connect to NAT gateway. How can this be achieved in terms of routing, etc?

1 Answers

Your proxy EC2 instance needs internet access despite being in a private subnet. That means tha the subnet’s route table will have to point to the NAT Gateway for destination The instance’s security group will have to allow outbound connections to any destination (you could restrict the ports), and inbound connections on the squid service port from the proxy clients.
Allow the squid clients to connect to the proxy instance security group on the access port (by default security groups are fully open for outbound comminications)

There is a gotcha: Unfortunately NAT Gateways do not support security groups, if you enable routing via the NAT Gateway from that private subnet, any instance in that subnet with a security group that allows unrestricted outbound communications will have access to the Internet via the NAT Gateway. You have to solve that (perhaps via NACLs or strict outbound security groups on the other instances).

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?