Deploying Open Policy Agent in a VPC Private Subnet with a Proxy for Secure Policy Enforcement

The network is locked behind layers of firewalls and private routes, but your policies still need enforcement. Open Policy Agent (OPA) can run inside a VPC private subnet without exposing ports to the public internet. The key is deploying OPA behind a proxy that bridges secure internal services with controlled external access.

This setup protects sensitive workloads while giving you centralized, dynamic policy enforcement. OPA evaluates requests locally inside the subnet, reducing latency and removing direct network exposure. The proxy handles any necessary outbound connections, ensuring all policy checks flow through approved paths.

To deploy OPA in a VPC private subnet proxy architecture:

  1. Provision Private Subnet – In AWS or your chosen cloud provider, create a private subnet that isolates OPA from public IPs.
  2. Install OPA – Deploy the OPA agent to EC2 instances, containers, or managed compute nodes within that subnet.
  3. Configure Proxy – Use Nginx, Envoy, or AWS PrivateLink as the proxy. The proxy receives traffic from permitted internal services. It passes requests to OPA over secure channels.
  4. Manage Policies – Store and update Rego policies in a secure repo. Sync them to OPA using the proxy’s access routes or cloud-native service meshes.
  5. Test and Audit – Verify policy decisions by simulating traffic from internal systems through the proxy. Log enforcement results for compliance.

Security hardening steps include disabling unused ports, enforcing TLS between proxy and agent, and using IAM roles for authentication. The combination of private subnet isolation and proxy routing keeps policy enforcement contained while remaining flexible.

OPA in a private subnet proxy configuration is ideal for scenarios where data must never leave a secure network yet still comply with evolving access rules. It aligns cloud-native architecture with strict governance.

You can see an OPA VPC private subnet proxy deployment in action without the usual setup overhead. Visit hoop.dev and spin up a live demonstration in minutes.