> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Formal Connector

> The protocol-aware reverse proxy that controls and logs access to your resources

## What is a Connector?

The Formal Connector is a protocol-aware reverse proxy that sits between your users and your protected resources. It provides real-time visibility, policy enforcement, and access control over all data flowing through your infrastructure.

Two things keep the Connector easy to deploy and manage:

* **Smart Routing**: The Connector listens on a single port, automatically detects the wire protocol used by the client (PostgreSQL, MongoDB, HTTP, SSH, etc.), and parses this protocol in real-time
* **Configuration from the Control Plane**: The Connector receives its resources, listeners, and policies from the Control Plane. With a [Cloud Account](https://docs.formal.ai/docs/guides/integrations/clouds/introduction.md), the Control Plane discovers the resources in your cloud (RDS instances, EKS clusters, EC2 instances, and more), so you don't define each one by hand

## How Connectors Work

End users connect to a Connector directly, or the Endpoint forwards their connections to one:

```mermaid theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
sequenceDiagram
    participant Client
    participant Connector
    participant Resource

    Client->>Connector: Request
    Connector->>Connector: Authenticate the identity
    Connector->>Connector: Evaluate request policies
    Note over Connector: Allow, block, or rewrite
    Connector->>Resource: Forward the request
    Resource-->>Connector: Response
    Connector->>Connector: Evaluate response policies
    Note over Connector: Allow, mask, or filter
    Connector-->>Client: Response
    Note over Connector: Log the request and the session
```

## Within the Connector

The Connector is a reverse proxy: clients connect to it, and it receives their traffic. It parses the protocol, identifies the user, and evaluates policies against requests and responses. It can call [Hooks](https://docs.formal.ai/docs/guides/policies/hooks.md) to make policy decisions. The Connector also logs and records sessions, which you can review in the Control Plane.

| Component | Role |
| - | - |
| Protocol parser | Parses the traffic of each supported technology (Postgres, Snowflake, SSH, Kubernetes, HTTP, and more) |
| Policy engine (OPA) | Evaluates your policies and blocks, masks, or decrypts data |
| PII/PHI analyzer | Detects sensitive data in traffic, asynchronously |
| Logs and metrics collector | Collects logs and metrics |

### How a request flows through the Connector

1. The Connector receives its configuration (resources, listeners, policies) from the Control Plane.
2. A client connects to a Connector listener, either directly or through the Endpoint.
3. The Connector authenticates the user and parses the request.
4. Policies are evaluated against the request. If the request is allowed, the Connector forwards it to the resource.
5. Policies are evaluated against the response, for example to mask a column, and the session is logged.

### If the Control Plane is unreachable

A running Connector keeps working with the last configuration it received. It won't receive configuration updates until it reconnects, and a new Connector instance can't start serving traffic until it loads its configuration.

Logs are buffered on disk and sent once the connection is back. To keep buffered logs across restarts, mount persistent storage at `/formal/logs`. See [Connector operations](https://docs.formal.ai/docs/guides/core-concepts/connectors/operations.md#log-spool).

## Network and sizing

The Connector needs outbound access to `api.joinformal.com` and to the resources it protects. Your clients need access to the Connector's listener ports.

| Per Connector instance | Minimum | Recommended |
| - | -: | -: |
| CPU | 1 core | 2 cores |
| RAM | 2 GB | 4 GB |
| Disk | 0 GB | 10 GB |

Actual needs depend on your traffic volume, query types, and policies. CPU throttling can cause higher latency and timeouts. See the [network requirements](https://docs.formal.ai/docs/guides/core-concepts/connectors/deployment.md#network-requirements) and [resource requirements](https://docs.formal.ai/docs/guides/core-concepts/connectors/deployment.md#resource-requirements) for details.

On AWS, the Connector can reach the Control Plane through [VPC PrivateLink](https://docs.formal.ai/docs/guides/control-plane/private-link.md).

## High availability

We recommend running at least two Connector instances behind a load balancer. Configure readiness checks so that the load balancer only sends traffic to instances that have loaded their configuration.

Instances can also form a cluster to share state, such as rate-limit counters and cached entries. Clustering requires service discovery and port `7946` (TCP and UDP) open between instances. See [Connector clustering](https://docs.formal.ai/docs/guides/core-concepts/connectors/clustering.md) for ECS and Kubernetes setup.

## Monitoring and Health

The Connector exposes a health check endpoint on port 8080:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
curl http://connector-host:8080/health
```

For production monitoring, configure:

* **CloudWatch Logs** (AWS ECS)
* **kubectl logs** (Kubernetes)
* **Cloud Logging** (GCP)

## Configuration

> [tab] Control Plane
>
> 1. Navigate to [Connectors](https://app.formal.ai/connectors)
> 2. Click **Create Connector**
> 3. Enter a name (and optional Space), then click **Create**
> 4. Open the Connector → **Listeners** → **New Listener**
> 5. Add a rule with **New Rule** (**Resource** or **Technology**)
> 6. Copy the Connector API token from Connector details
> 7. Deploy the container with the token

> [tab] Terraform
>
> ```hcl theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
> resource "formal_connector" "production" {
>   name = "production-connector"
> }
>
> resource "formal_connector_listener" "postgres" {
>   connector_id = formal_connector.production.id
>   name         = "postgres-listener"
>   port         = 5432
> }
>
> resource "formal_connector_listener_rule" "postgres" {
>   connector_listener_id = formal_connector_listener.postgres.id
>   type                  = "resource"
>   rule                  = formal_resource.postgres.id
> }
>
> output "connector_token" {
>   value     = formal_connector.production.api_key
>   sensitive = true
> }
> ```

## Next Steps

> [card] [Add Resources](https://docs.formal.ai/docs/guides/core-concepts/resources)
>
> Define the databases, APIs, and infrastructure the Connector protects

> [card] [Configure Spaces](https://docs.formal.ai/docs/guides/core-concepts/spaces.md)
>
> Segment access with logical groupings

> [card] [Write Policies](https://docs.formal.ai/docs/guides/policies/introduction.md)
>
> Control who can access what with policy-as-code

> [card] [Monitor Sessions](https://docs.formal.ai/docs/guides/observability/sessions.md)
>
> View active connections and session recordings


## Related topics

- [Connector](https://docs.formal.ai/docs/changelog/connector.md)
- [Operate Connectors](https://docs.formal.ai/docs/guides/core-concepts/connectors/operations.md)
- [Formal MCP](https://docs.formal.ai/docs/guides/core-concepts/connectors/mcp-servers/formal.md)
- [FIPS Connector](https://docs.formal.ai/docs/guides/core-concepts/connectors/fips.md)
- [Monitor Connector Health](https://docs.formal.ai/docs/guides/core-concepts/connectors/health.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.