> ## 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.

# Resources

> Define the databases, APIs, and infrastructure that Formal protects

## What is a Resource?

A Resource is any system you want to protect with Formal—databases, APIs, Kubernetes clusters, SSH servers, and more. Resources define the endpoints that Connectors can route traffic to and enforce policies on.

## Supported Resource Types

Formal supports a wide range of technologies. [View all supported technologies](https://docs.formal.ai/docs/guides/core-concepts/resources/postgres.md).

> [card] [PostgreSQL](https://docs.formal.ai/docs/guides/core-concepts/resources/postgres.md)
>
> Including RDS, Aurora, Supabase, AlloyDB

> [card] [MySQL](https://docs.formal.ai/docs/guides/core-concepts/resources/mysql.md)
>
> Including RDS, Aurora

> [card] [MariaDB](https://docs.formal.ai/docs/guides/core-concepts/resources/mariadb.md)
>
> MariaDB servers

> [card] [Redshift](https://docs.formal.ai/docs/guides/core-concepts/resources/redshift.md)
>
> Amazon Redshift clusters

> [card] [MongoDB](https://docs.formal.ai/docs/guides/core-concepts/resources/mongodb.md)
>
> Self-hosted and Atlas

> [card] [Snowflake](https://docs.formal.ai/docs/guides/core-concepts/resources/snowflake.md)
>
> Cloud data warehouse

> [card] [BigQuery](https://docs.formal.ai/docs/guides/core-concepts/resources/bigquery.md)
>
> Google Cloud data warehouse

> [card] [ClickHouse](https://docs.formal.ai/docs/guides/core-concepts/resources/clickhouse.md)
>
> OLAP database

> [card] [AWS](https://docs.formal.ai/docs/guides/core-concepts/resources/aws.md)
>
> AWS service APIs

> [card] [DynamoDB](https://docs.formal.ai/docs/guides/core-concepts/resources/dynamodb.md)
>
> NoSQL database

> [card] [S3](https://docs.formal.ai/docs/guides/core-concepts/resources/s3.md)
>
> Object storage

> [card] [GCP](https://docs.formal.ai/docs/guides/core-concepts/resources/gcp.md)
>
> Google Cloud APIs

> [card] [HTTP](https://docs.formal.ai/docs/guides/core-concepts/resources/http.md)
>
> REST APIs and web services

> [card] [gRPC](https://docs.formal.ai/docs/guides/core-concepts/resources/grpc.md)
>
> High-performance RPC framework

> [card] [Web](https://docs.formal.ai/docs/guides/core-concepts/resources/web.md)
>
> Web applications and portals

> [card] [SSH](https://docs.formal.ai/docs/guides/core-concepts/resources/ssh.md)
>
> Linux servers and bastions

> [card] [RDP](https://docs.formal.ai/docs/guides/core-concepts/resources/rdp.md)
>
> Windows remote desktops

> [card] [Kubernetes](https://docs.formal.ai/docs/guides/core-concepts/resources/kubernetes.md)
>
> K8s clusters (kubectl exec)

## Creating a Resource

> [tab] Control Plane
>
> **1. Navigate to Resources**
>
> Go to [Resources](https://app.formal.ai/resources) in the Control Plane
>
> **2. Click Create Resource**
>
> Select the **Create Resource** button
>
> **3. Fill in connection details**
>
> * **Technology**: The technology (PostgreSQL, MongoDB, etc.)
> * **Resource Friendly Name**: A friendly identifier
> * **Hostname**: Database hostname or IP address
> * **Port**: Connection port (e.g., 5432 for PostgreSQL)
> * **Space**: (Optional) Logical grouping for access control
>
> **4. Configure options and create**
>
> * Set **Termination Protection** to prevent accidental deletion
> * Click **Create**. For technologies that support native users, the
>   Control Plane opens the **Add Native User** wizard next (you can skip and
>   configure later on the **Authentication** tab)
> * After create, configure **TLS**, **Hostnames**, **Aliases**, and
>   **Tags** from the resource details page as needed

> [tab] Terraform
>
> ```hcl theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
> resource "formal_resource" "production_postgres" {
>   name       = "production-postgres"
>   technology = "postgres"
>   hostname   = "prod-db.us-east-1.rds.amazonaws.com"
>   port       = 5432
>   space_id   = formal_space.production.id
>
>   # Optional: Termination protection
>   termination_protection = true
>
>   # Optional: Tags
>   tags = {
>     environment = "production"
>     team = "backend"
>   }
>
>   # Optional: Aliases
>   aliases = ["prod-postgres", "backend-postgres"]
> }
> ```

> [!TIP]
>
> Your resource doesn't need to be publicly accessible. The Connector reaches it
> from within your VPC.

## Testing Resource Connectivity

You can test resource connectivity directly from the Control Plane to verify that your resources are accessible and properly configured.

### Test Connection from Resource Details

1. Navigate to [Resources](https://app.formal.ai/resources) in the Control Plane
2. Click on the resource you want to test
3. In the **Resource Details** page, click the **Test Connection** button in the top-right corner
4. The system will attempt to connect to your resource and display the results

![Resource Details page showing Test Connection button and Database Name for Health Check configuration](https://mintcdn.com/formal/z9GNtynV1YHUDYCN/assets/images/resource-details-test-connection.png?fit=max\&auto=format\&n=z9GNtynV1YHUDYCN\&q=85\&s=633eaaa9a2541d88632d2944a6aedbab)

### Test Specific Connectors

1. From the Resource Details page, click **Test Connectors**
2. Select the connector you want to test from the list
3. Click **Test** to initiate a health check for that specific connector
4. Monitor the test status - you'll see "Testing..." with a spinner during the test
5. Review the results to identify any connectivity issues

![Test Connectors modal showing connector selection and testing status](https://mintcdn.com/formal/z9GNtynV1YHUDYCN/assets/images/test-connectors-modal.png?fit=max\&auto=format\&n=z9GNtynV1YHUDYCN\&q=85\&s=44cc31af3fd2226a2ea6984061acb599)

### Configure Health Check Database

For database resources, you can specify which database to use for health checks:

1. In the Resource Details page, open the **Discovery** tab
2. Under **Database Health Check**, enter the **Database Name** (e.g., "main", "postgres", "mysql")
3. Click **Save Health Check**
4. This database will be used for all subsequent health checks

If you leave this field empty, MySQL defaults to `mysql` and Postgres defaults to `postgres`.

Formal connects to that database and runs `SELECT 1`.
The native user must have permission to connect to the selected database.

### Understanding Test Results

#### Successful Connection Test

When all tests pass, you'll see a green "3/3 tests passed" indicator and a multi-stage validation flow:

1. **TCP Connection** - Verifies network connectivity to the resource
2. **TLS Check** - Protocol-specific TLS handshake validation (when applicable)
3. **Configuration Check** - Validates health check settings
4. **Authentication** - Validates user credentials (shows the authenticated user)
5. **Data Access** - Confirms database permissions for the user

The test results will show:

* Connector name and instance information
* Each validation stage with green checkmarks
* Specific user details for authentication and data access
* Resource identification

![Successful connection test results showing 3/3 tests passed with TCP Connection, Authentication, and Data Access stages](https://mintcdn.com/formal/z9GNtynV1YHUDYCN/assets/images/connection-test-success.png?fit=max\&auto=format\&n=z9GNtynV1YHUDYCN\&q=85\&s=795539b43d53cb4415090ca2e6e2f4e7)

### Health Check Stages Explained

Each health check performs multiple validation stages to ensure complete connectivity:

**TCP Check**: Basic network connectivity verification

* Verifies the connector can reach the resource endpoint
* Tests basic network connectivity

**TLS Check**: TLS/SSL handshake verification

* Only applicable to TLS-enabled resources
* Validates certificate and encryption setup

**Configuration Check**: Configuration validation

* Verifies health check configuration is valid
* Checks database name and other settings

**Authentication Check**: Authentication verification

* Tests authentication using configured native users
* Includes AWS IAM authentication for RDS resources

**Data Access Check**: Data access verification

* Runs `SELECT 1` against the configured health check database
* Confirms the connector can interact with the resource

#### Failed Connection Tests

When tests fail, you'll see error indicators and specific failure messages:

* **Timeout**: Resource could not be reached - check network configuration and firewall rules such as a security group in a cloud environment
* **Authentication Failed**: Verify credentials and native user configuration
* **Database Not Found**: Ensure the specified database exists and is accessible

![Failed connection test showing timeout error with red clock icon and "Connection Test Timed Out" message](https://mintcdn.com/formal/z9GNtynV1YHUDYCN/assets/images/connection-test-failed.png?fit=max\&auto=format\&n=z9GNtynV1YHUDYCN\&q=85\&s=faa91cd2f6b4710faf4731c12c7be23a)

### Updating Resources

Changes to resources (hostname, port, space, etc.) take effect immediately for new connections. Active sessions continue using old settings until they reconnect.

### Deleting Resources

> [!WARNING]
>
> Resources with **Termination Protection** enabled cannot be deleted until
> protection is disabled.

Before deleting a resource:

1. Check for active sessions
2. Remove it from any Connector listener rules
3. Disable termination protection if enabled
4. Confirm deletion

## Spaces and Resources

Resources can be assigned to a [Space](https://docs.formal.ai/docs/guides/core-concepts/spaces.md) to limit which Connectors can access them:

* **Resource with a Space**: Only Connectors in the same Space can access it
* **Resource without a Space**: Any Connector can access it

This allows you to create network segmentation and isolation patterns that match your infrastructure.


## Related topics

- [Get resource](https://docs.formal.ai/api-reference/corev1resourceservice/get-resource.md)
- [Create resource](https://docs.formal.ai/api-reference/corev1resourceservice/create-resource.md)
- [List resources](https://docs.formal.ai/api-reference/corev1resourceservice/list-resources.md)
- [Update resource](https://docs.formal.ai/api-reference/corev1resourceservice/update-resource.md)
- [Delete resource](https://docs.formal.ai/api-reference/corev1resourceservice/delete-resource.md)


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